hyperstack-cli
Command-line tool for building, deploying, and managing HyperStack stream specifications.
Installation
From Source
# Clone the repository
# Build and install the CLI
# Or just build (binary will be at target/release/hs)
Quick Start
- Initialize configuration
This creates a hyperstack.toml file with example configurations.
- Authenticate
# Register a new account
# Or login to an existing account
- Edit
hyperstack.tomlto configure your specs:
[]
= "my-project"
[]
= "./generated"
= "hyperstack-react" # optional
= "hyperstack" # optional, prefix for generated crate names
# Specs are auto-discovered from .hyperstack/*.ast.json
# Define explicitly for custom naming:
[[]]
= "settlement-game" # optional, defaults to kebab-case of entity
= "SettlementGame" # entity name or path to .ast.json
= "Settlement game state tracking" # optional
- Push your spec to the cloud
- Build and deploy
# Create a build from your spec
# Watch the build progress
- Connect to your deployment
# View deployment info including WebSocket URL
Commands
Authentication
hs auth register
Register a new account.
hs auth login
Login to your account.
hs auth logout
Logout and remove stored credentials.
hs auth status
Check if you're authenticated (local check only).
hs auth whoami
Verify your authentication with the server and show account info.
Spec Management
hs spec push [spec-name]
Push local specs with their AST to remote. Reads specs from hyperstack.toml and uploads AST from .hyperstack/<entity>.ast.json.
# Push all specs
# Push specific spec
hs spec pull
Pull remote specs to local config.
hs spec list
List all remote specs.
hs spec versions <spec-name>
Show version history for a spec.
hs spec show <spec-name>
Show detailed spec information.
# Show spec info with latest version
# Show specific version details
hs spec delete <spec-name>
Delete a spec from remote.
# Interactive confirmation
# Skip confirmation
Build Commands
hs build create <spec-name>
Create a new build from a spec.
# Build latest version
# Build specific version
# Build from local AST file
hs build list
List builds for your account.
# List builds
# Filter by status
# Limit results
hs build status <build-id>
Get detailed build status.
# Show status
# Watch progress until completion
# Output as JSON
hs build logs <build-id>
View build logs (opens CloudWatch logs URL).
Deployment Commands
hs deploy info <build-id>
Show deployment info for a completed build.
Output includes:
- Atom name
- Namespace
- WebSocket URL
- Container image
hs deploy list
List all active deployments.
SDK Generation
hs sdk list
List all available specs from your configuration.
hs sdk create typescript <spec-name>
Generate a TypeScript SDK for the specified spec.
# Generate with default settings
# Generate with custom output path
# Generate with custom package name
hs sdk create rust <spec-name>
Generate a Rust SDK crate for the specified spec.
# Generate with default settings (outputs to ./generated/<spec-name>-stack/)
# Generate with custom output directory
# Generate with custom crate name
The generated crate includes:
Cargo.tomlwith hyperstack-sdk dependencysrc/lib.rswith re-exportssrc/types.rswith all data structssrc/entity.rswith Entity trait implementations
Usage after generation:
# Add to your Cargo.toml
[]
= "0.2"
= { = "./generated/settlement-game-stack" }
use HyperStack;
use ;
let hs = connect.await?;
let game = hs..await;
Configuration Management
hs config init
Initialize a new hyperstack.toml configuration file.
hs config validate
Validate your configuration file.
Configuration File Format
The hyperstack.toml file defines your project and available specs. The CLI auto-discovers AST files, so minimal configuration is needed:
[]
= "my-hyperstack-project" # required
[]
= "./generated" # optional, defaults to "./generated"
= "hyperstack-react" # optional, npm package for generated SDK
= "hyperstack" # optional, prefix for generated Rust crate names
[]
= true # optional, stream build progress
# Specs are auto-discovered from .hyperstack/*.ast.json files
# Only define [[specs]] if you need custom naming or explicit configuration
[[]]
= "my-spec" # optional, defaults to kebab-case of entity
= "MyEntity" # required: entity name or path to .ast.json
= "Optional description" # optional
Minimal Configuration
For most projects, you only need:
[]
= "my-project"
The CLI will auto-discover all .hyperstack/*.ast.json files and derive spec names from entity names (e.g., SettlementGame → settlement-game).
Build Process
When you create a build, the following happens:
- AST Validation: The spec's AST is validated
- Upload: AST is uploaded to S3
- Queue: Build is queued in CodeBuild
- Build: Docker image is built from the AST
- Push: Image is pushed to ECR
- Deploy: Container is deployed to Kubernetes
- Complete: WebSocket URL becomes available
Build statuses: pending -> uploading -> queued -> building -> pushing -> deploying -> completed/failed
Environment Variables
HYPERSTACK_API_URL: Override the API URL (default:http://localhost:3000)
How It Works
The CLI uses AST serialization to generate SDKs and deployments efficiently:
- The
#[stream_spec]macro automatically serializes the AST to.hyperstack/<entity_name>.ast.jsonwhen you compile your spec - CLI auto-discovers AST files - no manual configuration required for simple projects
- Push to cloud: The AST is uploaded and versioned
- Build: CodeBuild compiles the AST into a deployable container
- Deploy: The container runs as a WebSocket-accessible atom
This means:
- Zero-config for single-spec projects (just run
hyperstack up) - No need to recompile the CLI when adding new specs
- No feature flags or hardcoded registries
- Works with any spec in your workspace
- Content-addressed versioning (same AST = same version)
- Fast, efficient builds using pre-compiled base images
Troubleshooting
Error: "Not authenticated"
Run hs auth login to authenticate.
Error: "Spec 'xxx' not found"
Make sure the AST file exists at .hyperstack/<entity>.ast.json. Run:
This shows all auto-discovered and configured specs.
Error: "AST file not found"
Run cargo build in your spec crate to generate the AST file at .hyperstack/<entity>.ast.json.
Error: "Spec has no versions"
Push your spec first:
Build failed
Check the build logs:
License
Apache-2.0