Skip to content

Commit db553d7

Browse files
committed
Add automated installation script and update README
- in this repo we want to have, in the root folder, an installation script (like this one: [Pasted text]) that builds the VS Code extension from source and installs to user-selected editor (it needs to detect editors installed in the system like VS code or Vscodium and let user decide where to install/update) - `install.sh` should always work in temp dir - in `install.sh` [Pasted text] [Pasted text] - in `install.sh` if no editor is found, don't build - in `install.sh` [Pasted text] - replace [Fragment] with installation curl ├── .github │ └── workflows │ ├── deploy-vscode-extension.yml │ └── github-release.yml ├── README.md ├── apps │ └── editor │ ├── package.json │ └── src │ └── extension.ts ├── install.sh └── package.json
1 parent 6108bcf commit db553d7

2 files changed

Lines changed: 116 additions & 1 deletion

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</a>
99
</p>
1010
<p align="center">
11-
<a href="https://marketplace.visualstudio.com/items?itemName=robertpiosik.gemini-coder"><img src="https://img.shields.io/badge/Install-VS_Code_Marketplace-blue" alt="Get from Visual Studio Code Marketplace" /></a> <a href="https://open-vsx.org/extension/robertpiosik/gemini-coder"><img src="https://img.shields.io/badge/Install-Open_VSX_Registry-a60ee5" alt="Get from Open VSX Registry" /></a>
11+
<code>curl -fsSL https://raw.githubusercontent.com/robertpiosik/CodeWebChat/master/install.sh | bash</code>
1212
</p>
1313

1414
<p align="center"><strong>Blazing fast AI coding</strong></p>

‎install.sh‎

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
echo "========================================"
5+
echo " Code Web Chat - Installation Script"
6+
echo "========================================"
7+
echo ""
8+
9+
# Check required dependencies
10+
for cmd in git node pnpm; do
11+
if ! command -v $cmd &> /dev/null; then
12+
echo "Error: $cmd is required but not installed."
13+
exit 1
14+
fi
15+
done
16+
17+
# Validate Node.js version
18+
NODE_MAJOR_VERSION=$(node -v | sed 's/^v//' | cut -d. -f1)
19+
if [ "$NODE_MAJOR_VERSION" -lt 20 ]; then
20+
echo "Error: Node.js version 20 or higher is required (Node.js 22.x is recommended)."
21+
exit 1
22+
fi
23+
24+
# Detect available editors in the system
25+
declare -a AVAILABLE_EDITORS
26+
declare -a EDITOR_CMDS
27+
28+
check_editor() {
29+
if command -v "$2" >/dev/null 2>&1; then
30+
AVAILABLE_EDITORS+=("$1")
31+
EDITOR_CMDS+=("$2")
32+
fi
33+
}
34+
35+
check_editor "VS Code" "code"
36+
check_editor "VS Code Insiders" "code-insiders"
37+
check_editor "VSCodium" "codium"
38+
check_editor "Cursor" "cursor"
39+
check_editor "Windsurf" "windsurf"
40+
41+
if [ ${#AVAILABLE_EDITORS[@]} -eq 0 ]; then
42+
echo "Error: No supported editors found in your PATH."
43+
exit 1
44+
fi
45+
46+
echo "Detected editors:"
47+
for i in "${!AVAILABLE_EDITORS[@]}"; do
48+
echo "$((i+1))) ${AVAILABLE_EDITORS[$i]}"
49+
done
50+
echo "a) All detected editors"
51+
echo "q) Quit"
52+
echo ""
53+
54+
# Handle interactive prompt even if script is piped via curl | bash
55+
if [ -c /dev/tty ]; then
56+
read -p "Select editor(s) to install to: " choice < /dev/tty
57+
else
58+
read -p "Select editor(s) to install to: " choice
59+
fi
60+
61+
if [[ "$choice" == "q" || "$choice" == "Q" ]]; then
62+
echo "Installation cancelled."
63+
exit 0
64+
elif [[ "$choice" != "a" && "$choice" != "A" ]]; then
65+
if ! [[ "$choice" =~ ^[0-9]+$ ]] || [ "$choice" -lt 1 ] || [ "$choice" -gt "${#AVAILABLE_EDITORS[@]}" ]; then
66+
echo "Invalid choice. Exiting."
67+
exit 1
68+
fi
69+
fi
70+
71+
TMP_DIR=$(mktemp -d)
72+
trap 'rm -rf "$TMP_DIR"' EXIT
73+
echo ""
74+
echo "Cloning repository into temporary directory ($TMP_DIR)..."
75+
git clone --depth 1 https://github.com/robertpiosik/CodeWebChat.git "$TMP_DIR"
76+
cd "$TMP_DIR"
77+
REPO_DIR="$TMP_DIR"
78+
79+
echo ""
80+
echo "Installing workspace dependencies..."
81+
pnpm install
82+
83+
echo ""
84+
echo "Building VS Code extension..."
85+
cd apps/editor
86+
pnpm run build
87+
88+
VSIX_FILE=$(ls *.vsix | head -n 1)
89+
90+
if [ -z "$VSIX_FILE" ]; then
91+
echo "Error: VSIX file was not generated."
92+
exit 1
93+
fi
94+
95+
echo "Build successful: $VSIX_FILE"
96+
echo ""
97+
98+
install_to_editor() {
99+
local idx=$1
100+
local editor_name="${AVAILABLE_EDITORS[$idx]}"
101+
local editor_cmd="${EDITOR_CMDS[$idx]}"
102+
echo "Installing to $editor_name..."
103+
$editor_cmd --install-extension "$VSIX_FILE" --force
104+
}
105+
106+
if [[ "$choice" == "a" || "$choice" == "A" ]]; then
107+
for i in "${!AVAILABLE_EDITORS[@]}"; do
108+
install_to_editor $i
109+
done
110+
else
111+
install_to_editor $((choice-1))
112+
fi
113+
114+
echo ""
115+
echo "Done!"

0 commit comments

Comments
 (0)