Skip to content

Commit 6deac99

Browse files
committed
feat: remove npm distribution and add docs.rs + homebrew automation
- Remove npm distribution from release script and README - Add automated docs.rs rebuild triggering after crates.io publish - Create automated Homebrew formula update script - Update distribution guides and documentation - Remove npm directory and references
1 parent a9fb507 commit 6deac99

File tree

12 files changed

+491
-366
lines changed

12 files changed

+491
-366
lines changed

README.md

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
[![tool-eval](https://github.com/vinhnx/vtcode/actions/workflows/tool-eval.yml/badge.svg)](https://github.com/vinhnx/vtcode/actions/workflows/tool-eval.yml)
44
[![Crates.io](https://img.shields.io/crates/v/vtcode.svg)](https://crates.io/crates/vtcode)
5-
[![npm](https://img.shields.io/npm/v/vtcode.svg)](https://www.npmjs.com/package/vtcode)
65
[![Homebrew](https://img.shields.io/badge/dynamic/json?url=https://formulae.brew.sh/api/formula/vtcode.json&query=$.versions.stable&label=homebrew)](https://formulae.brew.sh/formula/vtcode)
76
[![GitHub release](https://img.shields.io/github/release/vinhnx/vtcode.svg)](https://github.com/vinhnx/vtcode/releases)
87
[![docs.rs](https://img.shields.io/docsrs/vtcode)](https://docs.rs/vtcode)
@@ -45,7 +44,7 @@ VTCode is a Rust-based terminal coding agent with modular architecture supportin
4544

4645
### Prerequisites
4746

48-
**For pre-built installations (Cargo, Homebrew, npm):** None - binaries are ready to use.
47+
**For pre-built installations (Cargo, Homebrew):** None - binaries are ready to use.
4948

5049
**For building from source:**
5150

@@ -85,17 +84,6 @@ brew install vinhnx/tap/vtcode
8584
- **Tap Repository**: [vinhnx/homebrew-tap](https://github.com/vinhnx/homebrew-tap)
8685
- **Formula**: [vtcode.rb](https://github.com/vinhnx/homebrew-tap/blob/main/vtcode.rb)
8786

88-
#### 📦 npm (Cross-platform)
89-
90-
[![npm](https://img.shields.io/npm/v/vtcode.svg)](https://www.npmjs.com/package/vtcode)
91-
92-
```bash
93-
npm install -g vtcode
94-
```
95-
96-
- **Package**: [npmjs.com/package/vtcode](https://www.npmjs.com/package/vtcode)
97-
- **Installation includes**: Pre-built binaries for your platform
98-
9987
#### 📥 Pre-built Binaries
10088

10189
[![GitHub release](https://img.shields.io/github/release/vinhnx/vtcode.svg)](https://github.com/vinhnx/vtcode/releases)
@@ -845,7 +833,7 @@ The project uses an automated release script that handles publishing to multiple
845833
./scripts/release.sh --patch --dry-run
846834

847835
# Skip certain distribution channels
848-
./scripts/release.sh --patch --skip-npm --skip-homebrew
836+
./scripts/release.sh --patch --skip-homebrew
849837
```
850838

851839
#### Distribution Channels
@@ -857,15 +845,11 @@ VTCode is available through multiple package managers for easy installation:
857845
- **API Docs**: [docs.rs/vtcode](https://docs.rs/vtcode)
858846
- **Source**: [crates.io/crates/vtcode](https://crates.io/crates/vtcode)
859847

860-
2. **📦 [npm](https://www.npmjs.com/package/vtcode)**: `npm install -g vtcode`
861-
862-
- **Package**: [npmjs.com/package/vtcode](https://www.npmjs.com/package/vtcode)
863-
864-
3. **🍺 [Homebrew](https://formulae.brew.sh/formula/vtcode)**: `brew install vinhnx/tap/vtcode`
848+
2. **🍺 [Homebrew](https://formulae.brew.sh/formula/vtcode)**: `brew install vinhnx/tap/vtcode`
865849

866850
- **Tap**: [vinhnx/homebrew-tap](https://github.com/vinhnx/homebrew-tap)
867851

868-
4. **📥 [GitHub Releases](https://github.com/vinhnx/vtcode/releases)**: Pre-built binaries
852+
3. **📥 [GitHub Releases](https://github.com/vinhnx/vtcode/releases)**: Pre-built binaries
869853
- **Linux x64, macOS x64/ARM64, Windows x64**
870854
- **Direct download**: [github.com/vinhnx/vtcode/releases](https://github.com/vinhnx/vtcode/releases)
871855

docs/project/DISTRIBUTION_SETUP_GUIDE.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,26 @@ npm whoami
7575

7676
For macOS distribution via Homebrew:
7777

78-
1. Create a Homebrew tap repository: `vinhnx/homebrew-tap`
79-
2. Add the VTCode formula to that repository
80-
3. Users can then install with: `brew install vinhnx/tap/vtcode`
78+
#### Automated Setup (Recommended)
79+
80+
The release script now includes automated Homebrew formula updates:
81+
82+
```bash
83+
# The release script will automatically update your Homebrew formula
84+
./scripts/release.sh --patch
85+
86+
# Or use the dedicated update script
87+
./scripts/update-homebrew-formula.sh 0.8.1 vinhnx/homebrew-tap
88+
```
89+
90+
#### Manual Setup
91+
92+
If you prefer manual control:
93+
94+
1. Create a tap repository: `YOUR_USERNAME/homebrew-tap`
95+
2. Add the formula from `homebrew/vtcode.rb`
96+
3. Update SHA256 hashes after each release
97+
4. See [Homebrew Setup Guide](homebrew-setup-guide.md) for detailed instructions
8198

8299
## Distribution Channels
83100

docs/project/TODO.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,7 @@ Set up Homebrew tap (optional):
230230

231231
Create vinhnx/homebrew-tap repository
232232
Add formula from vtcode.rb
233+
234+
---
235+
236+
update README guide, read the codebase and docs for context and update content with latest information.
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
# VTCode Homebrew Distribution Setup Guide
2+
3+
This guide will help you set up Homebrew distribution for VTCode on macOS.
4+
5+
## Prerequisites
6+
7+
1. **GitHub Repository**: You need a GitHub repository for your Homebrew tap
8+
2. **GitHub Release**: You need to create a GitHub release with pre-built binaries
9+
3. **SHA256 Hashes**: You need to calculate SHA256 hashes for your binaries
10+
11+
## Step 1: Create Homebrew Tap Repository
12+
13+
### Option A: Create a new tap repository
14+
15+
1. Create a new GitHub repository named `homebrew-tap` (or similar)
16+
2. Clone it locally:
17+
18+
```bash
19+
git clone https://github.com/YOUR_USERNAME/homebrew-tap.git
20+
cd homebrew-tap
21+
```
22+
23+
### Option B: Use existing tap repository
24+
25+
If you already have a tap repository, use that instead.
26+
27+
## Step 2: Create the Formula
28+
29+
Create a file named `vtcode.rb` in your tap repository:
30+
31+
```ruby
32+
class Vtcode < Formula
33+
desc "A Rust-based terminal coding agent with modular architecture"
34+
homepage "https://github.com/vinhnx/vtcode"
35+
version "0.8.1"
36+
37+
on_macos do
38+
if Hardware::CPU.arm?
39+
url "https://github.com/vinhnx/vtcode/releases/download/v#{version}/vtcode-v#{version}-aarch64-apple-darwin.tar.gz"
40+
sha256 "CALCULATE_THIS_SHA256_HASH"
41+
else
42+
url "https://github.com/vinhnx/vtcode/releases/download/v#{version}/vtcode-v#{version}-x86_64-apple-darwin.tar.gz"
43+
sha256 "CALCULATE_THIS_SHA256_HASH"
44+
end
45+
end
46+
47+
def install
48+
bin.install "vtcode"
49+
end
50+
51+
test do
52+
system "#{bin}/vtcode", "--version"
53+
end
54+
end
55+
```
56+
57+
## Step 3: Calculate SHA256 Hashes
58+
59+
After creating a GitHub release with your binaries, calculate the SHA256 hashes:
60+
61+
### For Intel Mac:
62+
63+
```bash
64+
# Download the Intel binary
65+
curl -L -o vtcode-intel.tar.gz https://github.com/vinhnx/vtcode/releases/download/v0.8.1/vtcode-v0.8.1-x86_64-apple-darwin.tar.gz
66+
67+
# Calculate SHA256
68+
shasum -a 256 vtcode-intel.tar.gz
69+
```
70+
71+
### For Apple Silicon Mac:
72+
73+
```bash
74+
# Download the ARM binary
75+
curl -L -o vtcode-arm.tar.gz https://github.com/vinhnx/vtcode/releases/download/v0.8.1/vtcode-v0.8.1-aarch64-apple-darwin.tar.gz
76+
77+
# Calculate SHA256
78+
shasum -a 256 vtcode-arm.tar.gz
79+
```
80+
81+
## Step 4: Update the Formula
82+
83+
Replace `CALCULATE_THIS_SHA256_HASH` with the actual SHA256 hashes in your `vtcode.rb` file.
84+
85+
## Step 5: Commit and Push
86+
87+
```bash
88+
git add vtcode.rb
89+
git commit -m "Add vtcode formula v0.8.1"
90+
git push origin main
91+
```
92+
93+
## Step 6: Test the Formula
94+
95+
Test your formula locally:
96+
97+
```bash
98+
# Test the formula
99+
brew install --build-from-source vtcode.rb
100+
101+
# Verify installation
102+
vtcode --version
103+
104+
# Uninstall for testing
105+
brew uninstall vtcode
106+
```
107+
108+
## Step 7: Update Release Script
109+
110+
Update your release script to automatically update the Homebrew formula. Here's how:
111+
112+
### Option A: Manual Update (Current)
113+
114+
The current release script shows instructions for manual update.
115+
116+
### Option B: Automated Update
117+
118+
To automate Homebrew formula updates, you can:
119+
120+
1. **Use GitHub Actions** to automatically update the formula when a new release is created
121+
2. **Use a script** to update the formula as part of your release process
122+
123+
Example automated update script:
124+
125+
```bash
126+
#!/bin/bash
127+
128+
# Update Homebrew formula
129+
update_homebrew_formula() {
130+
local version=$1
131+
local tap_repo="YOUR_USERNAME/homebrew-tap"
132+
local formula_path="vtcode.rb"
133+
134+
# Clone or update tap repository
135+
if [ ! -d "homebrew-tap" ]; then
136+
git clone "https://github.com/$tap_repo.git" homebrew-tap
137+
fi
138+
139+
cd homebrew-tap
140+
141+
# Update formula with new version and SHA256
142+
# This would require calculating SHA256 hashes automatically
143+
# Implementation depends on your CI/CD setup
144+
145+
cd ..
146+
}
147+
```
148+
149+
## Usage
150+
151+
Once your tap is set up, users can install VTCode with:
152+
153+
```bash
154+
# Add your tap
155+
brew tap YOUR_USERNAME/homebrew-tap
156+
157+
# Install VTCode
158+
brew install YOUR_USERNAME/homebrew-tap/vtcode
159+
```
160+
161+
Or if you name your tap `homebrew-tap`:
162+
163+
```bash
164+
brew tap YOUR_USERNAME/homebrew-tap
165+
brew install vtcode
166+
```
167+
168+
## Maintenance
169+
170+
### Updating the Formula
171+
172+
When you release a new version:
173+
174+
1. Create a new GitHub release with binaries
175+
2. Calculate new SHA256 hashes
176+
3. Update the `vtcode.rb` file in your tap repository
177+
4. Commit and push the changes
178+
179+
### Version Management
180+
181+
Keep your formula version in sync with your main project version. The formula should always point to the latest stable release.
182+
183+
## Troubleshooting
184+
185+
### Common Issues
186+
187+
1. **SHA256 mismatch**: Make sure you're using the correct SHA256 hash for the binary
188+
2. **Architecture issues**: Ensure you have binaries for both Intel and Apple Silicon Macs
189+
3. **Permission issues**: Make sure your tap repository is public or users have access
190+
191+
### Testing
192+
193+
Always test your formula before publishing:
194+
195+
```bash
196+
# Test installation
197+
brew install --build-from-source vtcode.rb
198+
199+
# Test functionality
200+
vtcode --version
201+
202+
# Clean up
203+
brew uninstall vtcode
204+
```
205+
206+
## Integration with Release Script
207+
208+
To integrate with your release script, add this function:
209+
210+
```bash
211+
# Function to update Homebrew formula
212+
update_homebrew_formula() {
213+
local version=$1
214+
local tap_repo="YOUR_USERNAME/homebrew-tap"
215+
216+
print_info "Updating Homebrew formula to version $version"
217+
218+
# Calculate SHA256 hashes for new binaries
219+
# This would need to be implemented based on your release process
220+
221+
print_info "Homebrew formula update instructions:"
222+
print_info "1. Update version in $tap_repo/vtcode.rb to $version"
223+
print_info "2. Update SHA256 hashes for new binaries"
224+
print_info "3. Commit and push changes to $tap_repo"
225+
print_info "4. Users can then run: brew install $tap_repo/vtcode"
226+
}
227+
```
228+
229+
This setup provides a complete Homebrew distribution system for VTCode that integrates with your existing release process.

homebrew/vtcode.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
class Vtcode < Formula
22
desc "A Rust-based terminal coding agent with modular architecture"
33
homepage "https://github.com/vinhnx/vtcode"
4-
url "https://github.com/vinhnx/vtcode/releases/download/v#{version}/vtcode-v#{version}-x86_64-apple-darwin.tar.gz"
5-
sha256 "CHANGE_THIS_SHA256_AFTER_FIRST_RELEASE"
6-
version "0.8.0"
4+
version "0.8.1"
75

86
on_macos do
97
if Hardware::CPU.arm?
108
url "https://github.com/vinhnx/vtcode/releases/download/v#{version}/vtcode-v#{version}-aarch64-apple-darwin.tar.gz"
11-
sha256 "CHANGE_THIS_SHA256_AFTER_FIRST_RELEASE"
9+
sha256 "CHANGE_THIS_SHA256_AFTER_FIRST_RELEASE" # Calculate: shasum -a 256 vtcode-v0.8.1-aarch64-apple-darwin.tar.gz
10+
else
11+
url "https://github.com/vinhnx/vtcode/releases/download/v#{version}/vtcode-v#{version}-x86_64-apple-darwin.tar.gz"
12+
sha256 "CHANGE_THIS_SHA256_AFTER_FIRST_RELEASE" # Calculate: shasum -a 256 vtcode-v0.8.1-x86_64-apple-darwin.tar.gz
1213
end
1314
end
1415

npm/README.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)