-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add single-command install script #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
seanmcgary
wants to merge
3
commits into
main
Choose a base branch
from
sm-install
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
# CLAUDE.md | ||
|
||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
||
## Project Overview | ||
|
||
EigenLayer DevKit is a CLI toolkit for scaffolding, developing, and testing EigenLayer Autonomous Verifiable Services (AVS). It's built in Go and focuses on the Hourglass task-based architecture. The DevKit is currently in closed alpha and intended for local experimentation and development only. | ||
|
||
## Common Development Commands | ||
|
||
### Building and Testing | ||
```bash | ||
# Build the CLI binary | ||
make build | ||
|
||
# Run all tests (may be slow) | ||
make tests | ||
|
||
# Run fast tests (skips slow integration tests) | ||
make tests-fast | ||
|
||
# Install binary to ~/bin/ and set up shell completion | ||
make install | ||
|
||
# Format code | ||
make fmt | ||
|
||
# Run linter | ||
make lint | ||
|
||
# Clean up build artifacts | ||
make clean | ||
``` | ||
|
||
### Testing the CLI | ||
After building, test the CLI: | ||
```bash | ||
./bin/devkit --help | ||
./bin/devkit avs --help | ||
``` | ||
|
||
### Cross-platform Builds | ||
```bash | ||
# Build for specific platforms | ||
make build/darwin-arm64 | ||
make build/darwin-amd64 | ||
make build/linux-arm64 | ||
make build/linux-amd64 | ||
|
||
# Build all platforms | ||
make release | ||
``` | ||
|
||
## Architecture Overview | ||
|
||
### CLI Command Structure | ||
The CLI is built with `urfave/cli/v2` and organized hierarchically: | ||
- **Main entry**: `cmd/devkit/main.go` | ||
- **Core commands**: All under `devkit avs` subcommand | ||
- **Command implementations**: `pkg/commands/` directory | ||
|
||
Key commands: | ||
- `devkit avs create` - Scaffold new AVS projects from templates | ||
- `devkit avs build` - Compile contracts and binaries via template scripts | ||
- `devkit avs devnet` - Manage local Docker-based development networks | ||
- `devkit avs call` - Simulate task execution | ||
- `devkit avs config/context` - Configuration management | ||
|
||
### Configuration System | ||
Multi-layered configuration with migration support: | ||
|
||
1. **Global Config** (`~/.config/devkit/config.yaml`): User preferences, telemetry settings | ||
2. **Project Config** (`config/config.yaml`): Project metadata, template info | ||
3. **Context Config** (`config/contexts/{context}.yaml`): Environment-specific settings (devnet, testnet, mainnet) | ||
|
||
**Current Versions**: Config v0.0.2, Context v0.0.6 | ||
|
||
The system includes automatic migrations between versions via `pkg/migration/` that preserve user customizations. | ||
|
||
### Template System Architecture | ||
Projects are scaffolded from versioned Git templates: | ||
- **Template registry**: `config/templates.yaml` defines available templates | ||
- **Template fetching**: `pkg/template/git_fetcher.go` handles Git operations | ||
- **Project initialization**: Templates provide `.devkit/scripts/init` for setup | ||
- **Build/run integration**: Templates provide `.devkit/scripts/build` and `.devkit/scripts/run` | ||
|
||
### Devnet System | ||
The devnet management system (`pkg/commands/devnet.go`) provides: | ||
- Local Docker-based Anvil chains with EigenLayer state forked from Holesky | ||
- Automated contract deployment (L1/L2) | ||
- Pre-funded test operators with BLS keystores | ||
- AVS registration and operator management | ||
|
||
### Package Organization | ||
- **`pkg/commands/`**: CLI command implementations | ||
- **`pkg/common/`**: Shared utilities, configuration, contracts, logging | ||
- **`pkg/template/`**: Git-based template management | ||
- **`pkg/telemetry/`**: PostHog analytics integration | ||
- **`pkg/migration/`**: Configuration migration system | ||
- **`pkg/hooks/`**: Command lifecycle hooks | ||
|
||
## Key Dependencies | ||
|
||
- **Go 1.23.6+** required | ||
- **EigenLayer contracts**: `github.com/Layr-Labs/eigenlayer-contracts` | ||
- **Hourglass AVS**: `github.com/Layr-Labs/hourglass-monorepo/ponos` | ||
- **External tools**: Docker, Foundry, Zeus (npm package `@layr-labs/[email protected]`) | ||
|
||
## Development Environment Setup | ||
|
||
1. Install prerequisites: Docker, Foundry, Go 1.23.6+, make, jq, yq | ||
2. Clone repository and run `make install` | ||
3. Zeus is automatically installed as npm global package during `make install` | ||
|
||
## Testing Patterns | ||
|
||
- Unit tests use standard Go testing | ||
- Integration tests may require Docker and external dependencies | ||
- Use `make tests-fast` for quick feedback during development | ||
- Integration tests in `test/integration/` directory | ||
|
||
## Configuration Migration | ||
|
||
When adding new configuration fields: | ||
1. Update config structs in `pkg/common/` | ||
2. Create migration in `config/configs/migrations/` or `config/contexts/migrations/` | ||
3. Update embedded config versions in `config/` | ||
4. Test migration with existing project configs | ||
|
||
## Template Development | ||
|
||
Templates must provide: | ||
- `.devkit/scripts/init` - Project initialization | ||
- `.devkit/scripts/build` - Build script for contracts/binaries | ||
- `.devkit/scripts/run` - Run script for AVS components | ||
- Standard Go project structure for task-based architecture | ||
|
||
## Telemetry System | ||
|
||
Optional PostHog-based telemetry with: | ||
- Global and project-level opt-in/opt-out | ||
- Privacy-conscious data collection | ||
- CI environment auto-detection (defaults to disabled) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# DevKit version | ||
DEVKIT_VERSION="v0.0.9" | ||
DEVKIT_BASE_URL="https://s3.amazonaws.com/eigenlayer-devkit-releases" | ||
|
||
# Detect platform | ||
OS=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
ARCH=$(uname -m) | ||
|
||
case $OS in | ||
darwin) OS="darwin" ;; | ||
linux) OS="linux" ;; | ||
*) echo "Error: Unsupported OS: $OS"; exit 1 ;; | ||
esac | ||
|
||
case $ARCH in | ||
x86_64|amd64) ARCH="amd64" ;; | ||
arm64|aarch64) ARCH="arm64" ;; | ||
*) echo "Error: Unsupported architecture: $ARCH"; exit 1 ;; | ||
esac | ||
|
||
PLATFORM="${OS}-${ARCH}" | ||
|
||
# Prompt for installation directory | ||
if [[ -t 0 ]]; then | ||
# Interactive terminal available | ||
echo "Where would you like to install DevKit?" | ||
echo "1) $HOME/bin (recommended)" | ||
echo "2) /usr/local/bin (system-wide, requires sudo)" | ||
echo "3) Custom path" | ||
read -p "Enter choice (1-3) [1]: " choice | ||
else | ||
# Non-interactive (piped), use default | ||
echo "Installing to $HOME/bin (default for non-interactive install)" | ||
choice=1 | ||
fi | ||
|
||
case ${choice:-1} in | ||
1) INSTALL_DIR="$HOME/bin" ;; | ||
2) INSTALL_DIR="/usr/local/bin" ;; | ||
3) | ||
read -p "Enter custom path: " INSTALL_DIR | ||
if [[ -z "$INSTALL_DIR" ]]; then | ||
echo "Error: No path provided" | ||
exit 1 | ||
fi | ||
;; | ||
*) echo "Invalid choice"; exit 1 ;; | ||
esac | ||
|
||
# Create directory if it doesn't exist | ||
if [[ "$INSTALL_DIR" == "/usr/local/bin" ]]; then | ||
sudo mkdir -p "$INSTALL_DIR" | ||
else | ||
mkdir -p "$INSTALL_DIR" | ||
fi | ||
|
||
# Download and install | ||
DEVKIT_URL="${DEVKIT_BASE_URL}/${DEVKIT_VERSION}/devkit-${PLATFORM}-${DEVKIT_VERSION}.tar.gz" | ||
echo "Downloading DevKit ${DEVKIT_VERSION} for ${PLATFORM}..." | ||
|
||
if [[ "$INSTALL_DIR" == "/usr/local/bin" ]]; then | ||
curl -sL "$DEVKIT_URL" | sudo tar xz -C "$INSTALL_DIR" | ||
else | ||
curl -sL "$DEVKIT_URL" | tar xz -C "$INSTALL_DIR" | ||
fi | ||
|
||
echo "✅ DevKit installed to $INSTALL_DIR/devkit" | ||
|
||
# Add to PATH if needed | ||
if [[ "$INSTALL_DIR" == "$HOME/bin" ]] && [[ ":$PATH:" != *":$HOME/bin:"* ]]; then | ||
echo "💡 Add $HOME/bin to your PATH:" | ||
echo " echo 'export PATH=\"\$HOME/bin:\$PATH\"' >> ~/.$(basename $SHELL)rc" | ||
fi | ||
|
||
echo "🚀 Verify installation: $INSTALL_DIR/devkit --help" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this use the root VERSION file to get the latest devkit version ? This way we won't have to update it on every release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.