Skip to content

Commit 4c55829

Browse files
committed
feat(docs): update installation instructions and add script
- Changed local development instructions to use install script - Added supported platforms table for clarity - Updated README with correct repository URL - Introduced an install script for easier setup - Enhanced package.json description and metadata
1 parent 1a353b5 commit 4c55829

File tree

3 files changed

+140
-11
lines changed

3 files changed

+140
-11
lines changed

README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,34 @@ AI-powered git auto-commit tool that intelligently groups your changes and gener
1515

1616
## Installation
1717

18-
### Local Development
18+
Downloads the correct pre-compiled binary for your OS and architecture directly from [GitHub Releases](https://github.com/misaelabanto/commita/releases):
1919

2020
```bash
21-
git clone <repository-url>
22-
cd commita
23-
bun install
21+
curl -fsSL https://raw.githubusercontent.com/misaelabanto/commita/main/install.sh | bash
2422
```
2523

26-
### Global Installation (Coming Soon)
24+
Supported platforms:
25+
26+
| OS | x86_64 | arm64 |
27+
|-------|--------|-------|
28+
| macOS |||
29+
| Linux |||
30+
31+
> Windows users: download the binary manually from the [Releases page](https://github.com/misaelabanto/commita/releases).
32+
33+
### Local Development
2734

2835
```bash
29-
bun install -g commita
36+
git clone https://github.com/misaelabanto/commita.git
37+
cd commita
38+
bun install
3039
```
3140

3241
## Quick Start
3342

3443
1. Clone and install dependencies:
3544
```bash
36-
git clone <repository-url>
45+
git clone https://github.com/misaelabanto/commita.git
3746
cd commita
3847
bun install
3948
```
@@ -46,7 +55,7 @@ cp .commita.example .commita
4655

4756
3. Navigate to your project and run:
4857
```bash
49-
/path/to/commita/index.ts --all
58+
commita --all
5059
```
5160

5261
## Configuration

install.sh

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
REPO="misaelabanto/commita"
6+
BINARY_NAME="commita"
7+
INSTALL_DIR="/usr/local/bin"
8+
9+
# Colors
10+
RED='\033[0;31m'
11+
GREEN='\033[0;32m'
12+
YELLOW='\033[1;33m'
13+
CYAN='\033[0;36m'
14+
NC='\033[0m' # No Color
15+
16+
info() { echo -e "${CYAN}[commita]${NC} $*"; }
17+
success() { echo -e "${GREEN}[commita]${NC} $*"; }
18+
warn() { echo -e "${YELLOW}[commita]${NC} $*"; }
19+
error() { echo -e "${RED}[commita]${NC} $*" >&2; exit 1; }
20+
21+
# Detect OS
22+
detect_os() {
23+
local os
24+
os=$(uname -s | tr '[:upper:]' '[:lower:]')
25+
case "$os" in
26+
darwin) echo "darwin" ;;
27+
linux) echo "linux" ;;
28+
msys*|mingw*|cygwin*) echo "windows" ;;
29+
*) error "Unsupported OS: $os" ;;
30+
esac
31+
}
32+
33+
# Detect architecture
34+
detect_arch() {
35+
local arch
36+
arch=$(uname -m)
37+
case "$arch" in
38+
x86_64|amd64) echo "amd64" ;;
39+
arm64|aarch64) echo "arm64" ;;
40+
*) error "Unsupported architecture: $arch" ;;
41+
esac
42+
}
43+
44+
# Check for required tools
45+
check_deps() {
46+
for cmd in curl; do
47+
if ! command -v "$cmd" &>/dev/null; then
48+
error "'$cmd' is required but not installed."
49+
fi
50+
done
51+
}
52+
53+
# Get latest release tag from GitHub API
54+
get_latest_tag() {
55+
local tag
56+
tag=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" \
57+
| grep '"tag_name"' \
58+
| sed -E 's/.*"([^"]+)".*/\1/')
59+
60+
if [ -z "$tag" ]; then
61+
error "Failed to fetch the latest release tag. Check your internet connection or visit https://github.com/${REPO}/releases."
62+
fi
63+
64+
echo "$tag"
65+
}
66+
67+
main() {
68+
check_deps
69+
70+
local os arch
71+
os=$(detect_os)
72+
arch=$(detect_arch)
73+
74+
# Windows is not supported via this script — direct users to releases
75+
if [ "$os" = "windows" ]; then
76+
error "Windows is not supported by this install script. Please download the binary manually from: https://github.com/${REPO}/releases"
77+
fi
78+
79+
local tag
80+
tag=$(get_latest_tag)
81+
82+
local binary_file="${BINARY_NAME}-${os}-${arch}"
83+
local download_url="https://github.com/${REPO}/releases/download/${tag}/${binary_file}"
84+
local tmp_file
85+
tmp_file=$(mktemp)
86+
87+
info "Detected platform: ${os}/${arch}"
88+
info "Latest version: ${tag}"
89+
info "Downloading ${binary_file}..."
90+
91+
if ! curl -fsSL --progress-bar "$download_url" -o "$tmp_file"; then
92+
rm -f "$tmp_file"
93+
error "Download failed. Please check: ${download_url}"
94+
fi
95+
96+
chmod +x "$tmp_file"
97+
98+
# Install to INSTALL_DIR, using sudo if needed
99+
if [ -w "$INSTALL_DIR" ]; then
100+
mv "$tmp_file" "${INSTALL_DIR}/${BINARY_NAME}"
101+
else
102+
warn "Installing to ${INSTALL_DIR} requires elevated privileges."
103+
sudo mv "$tmp_file" "${INSTALL_DIR}/${BINARY_NAME}"
104+
fi
105+
106+
success "${BINARY_NAME} ${tag} installed to ${INSTALL_DIR}/${BINARY_NAME}"
107+
echo ""
108+
echo " Get started: commita --help"
109+
echo " Docs: https://github.com/${REPO}#readme"
110+
echo ""
111+
}
112+
113+
main "$@"

package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "commita",
2+
"name": "@misaelabanto/commita",
33
"version": "1.0.1",
4-
"description": "AI-powered git auto-commit tool",
4+
"description": "AI-powered git auto-commit tool that intelligently groups your changes and generates meaningful commit messages",
55
"module": "index.ts",
66
"type": "module",
77
"private": false,
@@ -13,6 +13,13 @@
1313
"build": "bun build index.ts --outdir dist --target bun",
1414
"commita": "bun run index.ts"
1515
},
16+
"author": "Misael Abanto",
17+
"license": "MIT",
18+
"repository": {
19+
"type": "git",
20+
"url": "git+https://github.com/misaelabanto/commita.git"
21+
},
22+
"homepage": "https://github.com/misaelabanto/commita#readme",
1623
"dependencies": {
1724
"@ai-sdk/google": "^2.0.28",
1825
"@ai-sdk/openai": "^2.0.62",
@@ -30,4 +37,4 @@
3037
"peerDependencies": {
3138
"typescript": "^5"
3239
}
33-
}
40+
}

0 commit comments

Comments
 (0)