This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Envyr is a Rust CLI tool that automagically packages applications and runs them in sandboxed environments. It detects language types (Python, Node.js, Shell scripts), installs dependencies, and executes projects in Docker containers without requiring local setup.
cargo build- Build the projectcargo build --release- Build optimized release versioncargo check- Check code for errors without buildingcargo run -- <args>- Run envyr with argumentscargo test- Run all tests (unit and integration)cargo test --bin envyr- Run unit tests onlycargo test --test integration_tests- Run integration tests only
make build-linux- Build for both x86_64 and aarch64 Linux targetsmake build-linux-x86- Build for x86_64-unknown-linux-muslmake build-linux-aarch64- Build for aarch64-unknown-linux-muslmake build-darwin-x86- Build for x86_64-apple-darwinmake build-darwin-aarch64- Build for aarch64-apple-darwin
cargo run -- run --autogen <git-repo-url>- Test running a repository with auto-detectioncargo run -- generate <project-path>- Generate metadata for a projectcargo run -- alias list- List stored aliasescargo run -- run --timeout <seconds> --autogen <project>- Run with execution timeout
-
CLI Interface (
src/main.rs): Built with clap, handles three main commands:generate: Creates.envyr/meta.jsonmetadata filesrun: Executes projects in sandboxed environmentsalias: Manages command aliases for frequently used projects
-
Package Detection (
src/envyr/package.rs):- Analyzes project directories to detect language type (Python, Node.js, Shell, Other)
- Identifies entrypoints, dependencies, and interpreters
- Supports override options for manual configuration
-
Fetchers (
src/envyr/adapters/):git.rs: Handles git repository cloning and cachingfetcher.rs: Abstracts different source types (local paths, git repos)
-
Execution Engines:
docker.rs: Docker container-based execution (primary implementation)meta.rs: Metadata generation and management- Future: Nix and native execution (marked as todo)
-
Template System (
src/envyr/templates.rs): Generates Dockerfiles and configurations
- Source fetching (git clone or local path resolution)
- Project analysis and metadata generation
- Sandbox creation (Docker image build)
- Execution with proper volume mounts and environment setup
- User data stored in
~/.envyr/ - Project metadata in
.envyr/meta.jsonwithin each analyzed project - Alias configurations for frequently used commands
Currently implemented:
- Python: Detects
.pyfiles,requirements.txt, uses pipreqs for auto-generation - Node.js: Requires
package.json, uses npm for dependency management - Shell: Detects shebang, manual dependency specification needed
src/main.rs:200-350- Main command handling and configuration parsingsrc/envyr/package.rs:44-47- Project analysis entry pointsrc/envyr/docker.rs- Docker execution implementationsrc/envyr/meta.rs:22-40- Metadata file generation
The project now includes comprehensive test coverage:
- utils.rs tests: Core utility function testing (file detection, shebang parsing, etc.)
- package.rs tests: Project analysis, Pack building and serialization
- docker.rs tests: Docker command generation, Dockerfile templates, image naming
- meta.rs tests: Metadata generation, alias management
- CLI command tests: Help, version, generate, alias commands
- Project generation tests: Python, Node.js, Shell project detection and metadata creation
- Error handling tests: Invalid paths, missing dependencies
- ✅ File type detection (Python, Node.js, Shell)
- ✅ Project analysis and entrypoint detection
- ✅ Docker image naming and command generation
- ✅ Environment variable and volume mapping
- ✅ Alias storage and retrieval
- ✅ CLI argument parsing and validation
- ✅ Template generation (Dockerfile, .dockerignore)
- ✅ Timeout functionality (Docker and Podman compatible)
- ✅ Real-time output preservation during timeout operations
# Run all tests
cargo test
# Run only unit tests
cargo test --bin envyr
# Run only integration tests
cargo test --test integration_tests
# Run specific test module
cargo test envyr::utils::tests
# Run with verbose output
cargo test -- --nocapture