Overview
Workspace management in Ahh CLI allows you to instantly initialize pre-configured development environments. Workspaces are templates that include:- Pre-installed dependencies
- Configured tooling
- Sample code and examples
- Ready-to-use development environments
How It Works
When you initialize a workspace, the CLI:- Downloads a compressed workspace archive from the Ahh workspace repository
- Caches it locally for faster future use
- Extracts the contents to your specified directory
- Creates a fully-configured development environment
Workspaces are cached after the first download, making subsequent initializations nearly instant.
Basic Usage
List Available Workspaces
Currently available workspaces:Initialize a Workspace
Specify Custom Directory
Example Output
Available Workspaces
python-pwntools-interact
Pre-configured Python environment with pwntools for CTF binary exploitation.Includes:
- Python 3 with pwntools
- Common exploitation libraries
- Sample interaction scripts
web-xss-template
Template for testing and demonstrating XSS vulnerabilities.Includes:
- HTML/JS templates
- XSS payload examples
- Testing environment setup
Implementation Details
Workspace Download and Caching
The system downloads and caches workspaces efficiently:/home/daytona/workspace/source/ahh-binary/src/commands/workspace/main.ts:12-18
Workspace Loading
Cached workspaces are copied to the target location:/home/daytona/workspace/source/ahh-binary/src/commands/workspace/main.ts:20-24
Initialization Flow
The complete initialization process:/home/daytona/workspace/source/ahh-binary/src/commands/workspace/main.ts:26-35
Workspace Directory Structure
Workspaces are stored in your home directory:/home/daytona/workspace/source/ahh-binary/src/commands/workspace/main.ts:6-10
Workspace Registry
Available workspaces are defined in a constants file:/home/daytona/workspace/source/ahh-binary/src/commands/workspace/choices.ts:1-4
Command Line Interface
The workspace command uses yargs for argument parsing:/home/daytona/workspace/source/ahh-binary/main.ts:102-124
Use Cases
- CTF Challenges
- Security Testing
- Learning & Demos
Perfect for Capture The Flag competitions:Benefits:
- No dependency installation
- Pre-configured pwntools
- Ready-to-use templates
Workspace Sources
Workspaces are downloaded from:/home/daytona/workspace/source/ahh-binary/src/constants/main.ts:11-13
The download URL format is:
Performance Optimization
Caching Strategy
The implementation uses smart caching:- First use: Downloads and caches the workspace
- Subsequent uses: Copies from local cache (nearly instant)
- Multiple projects: Each initialization copies from cache
Parallel Operations
The download and extraction happen in a single command:Advanced Usage
Multiple Instances
Create multiple instances of the same workspace:Custom Locations
Organize workspaces in your project structure:Programmatic Usage
Troubleshooting
Download fails or times out
Download fails or times out
Solutions:
- Check your internet connection
- Verify the workspace name is correct
- Try again (downloads can sometimes fail)
- Check if
https://cli.ahh.betis accessible
Directory already exists
Directory already exists
If the target directory exists:
Cache corruption
Cache corruption
If you suspect cache corruption:
Permission errors
Permission errors
Ensure you have write permissions:
Best Practices
- Use descriptive paths - When using
--path, choose meaningful names - Cache awareness - First download may be slow; subsequent uses are fast
- Version control - Consider adding initialized workspaces to
.gitignore - Customize after init - Workspaces are templates; modify them for your needs
- Clean up - Remove unused workspace instances to save disk space
Creating Custom Workspaces
Workspace structure requirements:Cache Management
View Cache Size
Clear All Cached Workspaces
Clear Specific Workspace Cache
Related Commands
While workspaces are standalone, they work well with other Ahh features:Technical Reference
Command Options
| Option | Alias | Type | Required | Description |
|---|---|---|---|---|
name | - | string | Yes | Name of the workspace (positional) |
--path | -p | string | No | Custom path for workspace |
Workspace Choices
Valid workspace names are enforced at the CLI level:Directory Locations
- Cache directory:
~/.ahh/workspaces/cache/ - Default output:
./{workspace-name} - Custom output: User-specified via
--path
Dependencies
- curl: For downloading workspace archives
- tar: For extracting compressed workspaces
- Bun: For shell command execution
