Skip to content

Commit 63f7244

Browse files
author
薛華慶, james.hsueh
committed
feat: chnage installing flow and update version to 1.0.13
1 parent 28c6f38 commit 63f7244

File tree

3 files changed

+52
-12
lines changed

3 files changed

+52
-12
lines changed

gsi_installer.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@ def download_commands(repo_url: str = "https://github.com/CodeMachine0121/GSI-Pr
142142
except subprocess.CalledProcessError as e:
143143
print_error(f"Failed to download: {e.stderr}")
144144
sys.exit(1)
145-
except FileNotFoundError:
146-
print_error("Git is not installed. Please install git first.")
147-
sys.exit(1)
148145

149146

150147
def install_commands(source_dir: Path, platforms: list[str], location: str, claude_type: str = "both") -> int:
@@ -306,6 +303,19 @@ def detect_installation_type() -> str:
306303
return "unknown"
307304

308305

306+
def check_git_available() -> bool:
307+
"""Check if git is available."""
308+
try:
309+
subprocess.run(
310+
["git", "--version"],
311+
capture_output=True,
312+
check=True
313+
)
314+
return True
315+
except (subprocess.CalledProcessError, FileNotFoundError):
316+
return False
317+
318+
309319
def main():
310320
"""Main installation flow."""
311321
print_header()
@@ -365,18 +375,24 @@ def main():
365375

366376
location = "project" if location_choice == 1 else "global"
367377

368-
# Step 3: Download
378+
# Step 3: Check git availability (only needed for downloading)
379+
if not check_git_available():
380+
print_error("Git is not installed. Please install git first.")
381+
print_info("You can download git from: https://git-scm.com/downloads")
382+
sys.exit(1)
383+
384+
# Step 4: Download
369385
print()
370386
source_dir = download_commands()
371387

372-
# Step 4: Install
388+
# Step 5: Install
373389
print()
374390
installed_count = install_commands(source_dir, platforms, location, claude_type)
375391

376-
# Step 5: Cleanup
392+
# Step 6: Cleanup
377393
shutil.rmtree(source_dir.parent)
378394

379-
# Step 6: Success message
395+
# Step 7: Success message
380396
print()
381397
print("=" * 60)
382398
print_success(f"Installation complete! Total files installed: {installed_count}")

install.sh

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,34 @@ echo ""
9393

9494
# Detect installation type
9595
if [ -d ".git" ]; then
96-
echo "✅ Git repository detected - Installing to current project"
97-
INSTALL_TYPE="project"
96+
echo "✅ Git repository detected"
97+
echo ""
98+
echo "Please choose installation type:"
99+
echo "1) Install to current project"
100+
echo "2) Install globally"
101+
read -p "Enter choice [1-2] (default: 1): " choice < /dev/tty
102+
103+
case ${choice:-1} in
104+
1)
105+
INSTALL_TYPE="project"
106+
;;
107+
2)
108+
INSTALL_TYPE="global"
109+
;;
110+
*)
111+
echo "Invalid choice. Exiting."
112+
exit 1
113+
;;
114+
esac
98115
else
99116
echo "❌ Not a git repository"
100117
echo ""
101118
echo "Please choose installation type:"
102119
echo "1) Install to current directory (manual project)"
103120
echo "2) Install globally"
104-
read -p "Enter choice [1-2]: " choice < /dev/tty
121+
read -p "Enter choice [1-2] (default: 2): " choice < /dev/tty
105122

106-
case $choice in
123+
case ${choice:-2} in
107124
1)
108125
INSTALL_TYPE="project"
109126
;;
@@ -124,6 +141,13 @@ echo "Repository: $REPO_URL"
124141
echo "(Set SDD_REPO_URL environment variable to override)"
125142
echo ""
126143

144+
# Check if git is available
145+
if ! command -v git &> /dev/null; then
146+
echo "❌ Git is not installed. Please install git first."
147+
echo " You can download git from: https://git-scm.com/downloads"
148+
exit 1
149+
fi
150+
127151
# Global installation
128152
if [ "$INSTALL_TYPE" = "global" ]; then
129153
# Create temp directory for cloning

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "gsi-protocol-installer"
3-
version = "1.0.12"
3+
version = "1.0.13"
44
description = "Installer for GSI-Protocol workflow commands (Claude Code & Codex)"
55
authors = [
66
{name = "James Hsueh", email = "[email protected]"}

0 commit comments

Comments
 (0)