Skip to content

Commit 9348ef0

Browse files
authored
Merge pull request #59 from openSVM/develop
Develop
2 parents 300c8a5 + d047540 commit 9348ef0

17 files changed

+1909
-6
lines changed

.cline_rules

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# OSVM CLI Project Rules
2+
3+
## CRITICAL: No Custom Scripts
4+
- **NEVER create custom shell scripts, Python scripts, or any standalone scripts in this repository**
5+
- **ALL functionality must be implemented within the osvm binary itself**
6+
- **The only way to execute functionality is through the compiled osvm binary**
7+
- If a feature needs to be added, it must be implemented in the Rust source code and compiled into osvm
8+
9+
## Project Structure
10+
- All code must be in Rust source files under src/
11+
- Use cargo build to compile changes
12+
- Execute features only via ./target/debug/osvm or cargo run
13+
14+
## Examples of what NOT to do:
15+
- ❌ Creating shell scripts (*.sh files)
16+
- ❌ Creating Python scripts (*.py files)
17+
- ❌ Creating any standalone executable scripts
18+
- ❌ Using external tools when osvm can handle it
19+
20+
## Examples of what TO do:
21+
- ✅ Implement features in Rust within src/
22+
- ✅ Use cargo build to compile
23+
- ✅ Run features via osvm binary commands
24+
- ✅ If osvm doesn't have a feature, implement it in the Rust code first

.gitignore

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,59 @@ notes/
99
.dist
1010
node_modules/
1111
.DS_Store
12+
~*.*
13+
*-ledger/
14+
*.log
1215

13-
package-lock.json
14-
~*.*
16+
# Additional logs and temporary files
17+
*.log.*
18+
*.tmp
19+
*.temp
20+
*.swp
21+
*.swo
22+
*.bak
23+
*.orig
24+
*.old
25+
*.rej
26+
*.out
27+
28+
# Runtime and crash dumps
29+
core
30+
core.*
31+
*.core
32+
*.stackdump
33+
*.dmp
34+
35+
# IDE specific files
36+
.idea/
37+
*.iml
38+
*.iws
39+
*.ipr
40+
.settings/
41+
.project
42+
.classpath
43+
*.sublime-workspace
44+
*.sublime-project
45+
.history/
46+
.ionide/
47+
osvm-local
48+
# OS specific files
49+
.DS_Store
50+
.DS_Store?
51+
._*
52+
.Spotlight-V100
53+
.Trashes
54+
ehthumbs.db
55+
Thumbs.db
56+
57+
# Rust specific
58+
debug/
59+
profile.*
60+
perf.*
61+
62+
# Project specific
63+
agave-validator-*.log
64+
solana-validator-*.log
65+
sonic-*.log
66+
eclipse-*.log
67+
osvm-*.log

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,11 @@ remote-wallet = ["solana-remote-wallet"]
5353
[patch.crates-io]
5454
curve25519-dalek = { git = "https://github.com/dalek-cryptography/curve25519-dalek", tag = "3.2.0" }
5555
crunchy = { path = "vendor/crunchy" }
56+
57+
# Custom scripts for development and deployment
58+
[package.metadata.scripts]
59+
install = "bash install-release.sh"
60+
install-dev = "cargo build && sudo cp target/debug/osvm /usr/bin/osvm"
61+
build-release = "cargo build --release"
62+
test-install = "cargo build --release && ./target/release/osvm --version"
63+
clean-install = "sudo rm -f /usr/bin/osvm /usr/bin/osvm.backup"

INSTALLATION.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# OSVM CLI Installation Guide
2+
3+
## 📦 Installation Methods
4+
5+
The OSVM CLI provides multiple ways to build and install the compiled release binary to `/usr/bin`:
6+
7+
### 1. Using Make (Recommended)
8+
9+
```bash
10+
# Install debug version (fast development)
11+
make install-dev
12+
13+
# Install release version (optimized)
14+
make build-release && sudo cp target/release/osvm /usr/bin/osvm
15+
16+
# Verify installation
17+
make verify-install
18+
19+
# Uninstall
20+
make uninstall
21+
22+
# Clean everything
23+
make clean-install
24+
```
25+
26+
### 2. Using Installation Script
27+
28+
```bash
29+
# Make script executable (if not already)
30+
chmod +x install-release.sh
31+
32+
# Run installation script
33+
./install-release.sh
34+
```
35+
36+
### 3. Manual Installation
37+
38+
```bash
39+
# Build release binary
40+
cargo build --release
41+
42+
# Copy to system path
43+
sudo cp target/release/osvm /usr/bin/osvm
44+
sudo chmod +x /usr/bin/osvm
45+
46+
# Verify
47+
osvm --version
48+
```
49+
50+
### 4. Using Cargo Make (Advanced)
51+
52+
If you have `cargo-make` installed:
53+
54+
```bash
55+
# Install cargo-make if needed
56+
cargo install cargo-make
57+
58+
# Use cargo-make tasks
59+
cargo make install
60+
cargo make install-dev
61+
cargo make verify-install
62+
```
63+
64+
## 🔧 Available Make Targets
65+
66+
- `make build` - Build debug binary
67+
- `make build-release` - Build optimized release binary
68+
- `make test` - Run all tests
69+
- `make install` - Build release and install to /usr/bin (requires sudo)
70+
- `make install-dev` - Install debug binary to /usr/bin (requires sudo)
71+
- `make uninstall` - Remove osvm from /usr/bin (requires sudo)
72+
- `make clean` - Clean build artifacts
73+
- `make clean-install` - Remove installed binaries and backups
74+
- `make verify-install` - Verify osvm installation
75+
- `make help` - Show all available commands
76+
77+
## 🎯 Quick Start
78+
79+
For most users, the simplest installation is:
80+
81+
```bash
82+
# Debug version (for development)
83+
make install-dev
84+
85+
# Or release version (for production)
86+
make build-release
87+
sudo cp target/release/osvm /usr/bin/osvm
88+
```
89+
90+
Then verify with:
91+
```bash
92+
osvm --version
93+
osvm --help
94+
```
95+
96+
## 🔒 Backup and Safety
97+
98+
The installation system automatically:
99+
- Creates backups of existing binaries at `/usr/bin/osvm.backup`
100+
- Verifies installation before committing changes
101+
- Provides rollback capability if installation fails
102+
103+
## 🚀 Usage After Installation
104+
105+
Once installed, you can use `osvm` from anywhere:
106+
107+
```bash
108+
osvm --help # Show help
109+
osvm rpc-manager test --status # Check test RPC status
110+
osvm rpc-manager devnet --help # Devnet RPC options
111+
osvm diagnostics # Run system diagnostics
112+
```

Makefile

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# OSVM CLI Makefile
2+
# Quick commands for building, testing, and installing
3+
4+
.PHONY: help build build-release test install install-dev clean clean-install uninstall
5+
6+
# Default target
7+
help:
8+
@echo "🚀 OSVM CLI Build & Installation Commands"
9+
@echo "========================================"
10+
@echo ""
11+
@echo "Build Commands:"
12+
@echo " make build - Build debug binary"
13+
@echo " make build-release - Build optimized release binary"
14+
@echo " make test - Run all tests"
15+
@echo ""
16+
@echo "Installation Commands:"
17+
@echo " make install - Build release and install to /usr/bin (requires sudo)"
18+
@echo " make install-dev - Install debug binary to /usr/bin (requires sudo)"
19+
@echo " make uninstall - Remove osvm from /usr/bin (requires sudo)"
20+
@echo ""
21+
@echo "Cleanup Commands:"
22+
@echo " make clean - Clean build artifacts"
23+
@echo " make clean-install - Remove installed binaries and backups"
24+
@echo ""
25+
@echo "Development Commands:"
26+
@echo " make run - Run the debug binary locally"
27+
@echo " make check - Check code without building"
28+
@echo " make fmt - Format code"
29+
@echo " make clippy - Run clippy linter"
30+
31+
# Build commands
32+
build:
33+
@echo "🔨 Building debug binary..."
34+
cargo build
35+
36+
build-release:
37+
@echo "🔨 Building release binary..."
38+
cargo build --release
39+
40+
test:
41+
@echo "🧪 Running tests..."
42+
cargo test
43+
44+
check:
45+
@echo "🔍 Checking code..."
46+
cargo check
47+
48+
fmt:
49+
@echo "🎨 Formatting code..."
50+
cargo fmt
51+
52+
clippy:
53+
@echo "📎 Running clippy..."
54+
cargo clippy -- -D warnings
55+
56+
# Installation commands
57+
install: build-release
58+
@echo "📦 Installing release binary..."
59+
./install-release.sh
60+
61+
install-dev: build
62+
@echo "📦 Installing debug binary..."
63+
sudo cp target/debug/osvm /usr/bin/osvm
64+
sudo chmod +x /usr/bin/osvm
65+
@echo "✅ Debug binary installed to /usr/bin/osvm"
66+
67+
uninstall:
68+
@echo "🗑️ Uninstalling osvm..."
69+
sudo rm -f /usr/bin/osvm
70+
@echo "✅ osvm removed from /usr/bin"
71+
72+
# Cleanup commands
73+
clean:
74+
@echo "🧹 Cleaning build artifacts..."
75+
cargo clean
76+
77+
clean-install: uninstall
78+
@echo "🧹 Cleaning installed binaries and backups..."
79+
sudo rm -f /usr/bin/osvm.backup
80+
@echo "✅ All installed files cleaned"
81+
82+
# Development commands
83+
run:
84+
@echo "🏃 Running debug binary..."
85+
cargo run
86+
87+
# Verification command
88+
verify-install:
89+
@echo "🧪 Verifying installation..."
90+
@if command -v osvm >/dev/null 2>&1; then \
91+
echo "✅ osvm is installed and accessible"; \
92+
echo "📍 Location: $$(which osvm)"; \
93+
echo "📦 Version: $$(osvm --version)"; \
94+
else \
95+
echo "❌ osvm is not installed or not in PATH"; \
96+
exit 1; \
97+
fi
98+
99+
# Quick development cycle
100+
dev: clean build test
101+
@echo "✅ Development build completed"
102+
103+
# Full release cycle
104+
release: clean build-release test install
105+
@echo "✅ Release build and installation completed"

Makefile.toml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[config]
2+
default_to_workspace = false
3+
min_version = "0.32.0"
4+
5+
[env]
6+
CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
7+
8+
[tasks.build-release]
9+
description = "Build release binary"
10+
command = "cargo"
11+
args = ["build", "--release"]
12+
13+
[tasks.install]
14+
description = "Install release binary to /usr/bin"
15+
dependencies = ["build-release"]
16+
script = ["./install-release.sh"]
17+
18+
[tasks.install-dev]
19+
description = "Install debug binary to /usr/bin"
20+
dependencies = ["build"]
21+
script = [
22+
"sudo cp target/debug/osvm /usr/bin/osvm",
23+
"sudo chmod +x /usr/bin/osvm",
24+
"echo '✅ Debug binary installed to /usr/bin/osvm'"
25+
]
26+
27+
[tasks.uninstall]
28+
description = "Remove osvm from /usr/bin"
29+
script = [
30+
"sudo rm -f /usr/bin/osvm",
31+
"echo '✅ osvm removed from /usr/bin'"
32+
]
33+
34+
[tasks.clean-install]
35+
description = "Remove all installed binaries and backups"
36+
dependencies = ["uninstall"]
37+
script = [
38+
"sudo rm -f /usr/bin/osvm.backup",
39+
"echo '✅ All installed files cleaned'"
40+
]
41+
42+
[tasks.verify-install]
43+
description = "Verify osvm installation"
44+
script = [
45+
'''
46+
if command -v osvm >/dev/null 2>&1; then
47+
echo "✅ osvm is installed and accessible"
48+
echo "📍 Location: $(which osvm)"
49+
echo "📦 Version: $(osvm --version)"
50+
else
51+
echo "❌ osvm is not installed or not in PATH"
52+
exit 1
53+
fi
54+
'''
55+
]
56+
57+
[tasks.dev-cycle]
58+
description = "Full development cycle: clean, build, test"
59+
dependencies = ["clean", "build", "test"]
60+
61+
[tasks.release-cycle]
62+
description = "Full release cycle: clean, build-release, test, install"
63+
dependencies = ["clean", "build-release", "test", "install"]

0 commit comments

Comments
 (0)