Hypershell v0.1.0
This page lists what the first release of Hypershell provides. Hypershell is a domain-specific language for shell-script-like programs, built with Context-Generic Programming (CGP), a Rust library whose macros generate traits and their wiring: a program is a Rust type, and the context that runs it chooses how each step is carried out.
Released on 2025-06-13.
- Release post: Hypershell: a type-level DSL for shell-scripting in Rust
- Crate:
hypershell0.1.0 on crates.io - Tag: v0.1.0
Summary
The hypershell! macro writes a program as a type, in a syntax with a pipe operator, bracketed
argument lists, and string literals. Each syntax type is a plain marker with no behavior, so the
crates that interpret it are separate: native commands through Tokio, HTTP through reqwest, JSON,
checksums, and WebSockets. Two contexts, HypershellCli and HypershellHttp, run a program, and
the presets they are built from let an application add its own syntax and handlers.
Compatibility
- Minimum Rust version: 1.87, and the repository's toolchain file names the same stable release.
- CGP version: requires
cgp0.4.1, andcgp-error-anyhow0.4.1 supplies the contexts'anyhowerror type. - Crates:
hypershell,hypershell-components,hypershell-tokio-components,hypershell-reqwest-components,hypershell-json-components,hypershell-hash-components,hypershell-tungstenite-components, andhypershell-macro, all at 0.1.0.
Upgrading
This is the project's first release, so there is nothing to upgrade from. Add hypershell beside
cgp and an async runtime such as Tokio, and import hypershell::prelude::*.
New features
The language
hypershell!, inhypershell-macro, turns the program's shell-like syntax into a type:|becomesPipeover aProduct!list, a bracketed list becomes the step's arguments, and a bare string literal becomes aSymbol!.- Commands:
SimpleExecruns a command and returns its output,StreamingExecstreams its input and output, andStaticArg,FieldArg,WithStaticArgs,WithArgs,FieldArgs,JoinArgs, andUrlEncodeArgbuild its arguments from literals and context fields. - HTTP:
SimpleHttpRequestandStreamingHttpRequest, with the methodsGetMethod,PostMethod,PutMethod, andDeleteMethod, andHeaderandWithHeadersfor headers. - Streams and files:
StreamToStdout,StreamToBytes,StreamToString,BytesToStream, andBytesToStringconvert between stream and value forms, andReadFileandWriteFileread and write files.StreamToLineshas a handler,HandleStreamToLines, that no preset wires. - Data:
EncodeJsonandDecodeJson,ConvertTofor a conversion between types, andChecksumandBytesToHexinhypershell-hash-components. - Composition:
Piperuns steps in sequence, passing each output to the next, andUse<Provider, Code>hands its code to the handlerProvidernames;WebSocketconnects to a WebSocket endpoint.
Interpretation
hypershell-tokio-componentsruns commands as Tokio child processes and handles the stream and file steps.hypershell-reqwest-componentssends the HTTP steps withreqwest.hypershell-json-components,hypershell-hash-components, andhypershell-tungstenite-componentshandle the JSON, checksum, and WebSocket steps, the last throughtokio-tungstenite.
Contexts and presets
HypershellCli, a context without fields, runs programs whose steps need nothing from the context, such as commands, streams, files, and JSON.HypershellHttphas the same wiring and areqwestClientin itshttp_clientfield, which the HTTP steps read.- Presets: the component crates other than
hypershell-hash-componentsexportcgp_preset!presets of their handlers, such asHypershellTokioPresetandHypershellReqwestPreset, andHypershellPresetcombines them. An application builds its own preset on them to add syntax or replace a handler, ashttp_checksum_nativedoes to add the checksum handlers.
Examples
The hypershell-examples crate, which is not published, holds the programs the release post walks
through, among them hello,
hello_name, and
http_checksum_native.
An AI agent wrote this page from the release's source changes and the CGP knowledge base. Its content was verified against the project's source at the release's tag. See How AI is used in this project.