Elffuss BraidHub

kikocis/continue public

feat: create `oneper` util script (#6783)

* feat: create `oneper` util

* Update oneper

* Update oneper

* feat: add cross-platform VSIX builds

- Update vscode-package-extension job to build on both ubuntu and macos
- Add platform-specific artifact names (vscode-extension-build-Linux/macOS)
- Update oneper script to support --platform flag (macos/linux)
- Change VSIX naming to continue-VERSION-PR.vsix format
- Remove unnecessary unzip dependency check

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: ensure dependencies are installed in matrix packaging job

The macOS packaging job was failing because dependencies weren't
available from cache. Added fallback npm ci commands to install
dependencies if node_modules directories don't exist.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: use matrix strategy for dependency jobs

Instead of fallback npm ci commands, update the dependency jobs
(install-core, install-config-yaml, install-openai-adapters, install-vscode)
to also use the matrix strategy. This ensures proper cross-platform
dependency caching and cleaner builds.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: add reload instructions to --latest command

Consistency improvement - both --pr and --latest installations
now show reload instructions to help users activate the new
extension version.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Changesete3ae9dfc003ac42c0858e8731e4e0194065acfd5fe83a7ac1de512156f018f60
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-07-24 16:42 -07:00
CommitterGitHub <noreply@github.com> · 2025-07-24 16:42 -07:00
Parentsd5669e48ee7b

Browse the files at this changeset

2 files changed

modified .github/workflows/pr_checks.yaml +22 −7
@@ -50,7 +50,10 @@
5050
5151 install-config-yaml:
5252 needs: install-root
53- runs-on: ubuntu-latest
53+ runs-on: ${{ matrix.os }}
54+ strategy:
55+ matrix:
56+ os: [ubuntu-latest, macos-latest]
5457 steps:
5558 - uses: actions/checkout@v4
5659
@@ -77,7 +80,10 @@
7780
7881 install-openai-adapters:
7982 needs: install-root
80- runs-on: ubuntu-latest
83+ runs-on: ${{ matrix.os }}
84+ strategy:
85+ matrix:
86+ os: [ubuntu-latest, macos-latest]
8187 steps:
8288 - uses: actions/checkout@v4
8389
@@ -133,7 +139,10 @@
133139
134140 install-core:
135141 needs: install-root
136- runs-on: ubuntu-latest
142+ runs-on: ${{ matrix.os }}
143+ strategy:
144+ matrix:
145+ os: [ubuntu-latest, macos-latest]
137146 steps:
138147 - uses: actions/checkout@v4
139148
@@ -381,7 +390,10 @@
381390 install-vscode:
382391 needs:
383392 [install-root, install-core, install-config-yaml, install-openai-adapters]
384- runs-on: ubuntu-latest
393+ runs-on: ${{ matrix.os }}
394+ strategy:
395+ matrix:
396+ os: [ubuntu-latest, macos-latest]
385397 steps:
386398 - uses: actions/checkout@v4
387399
@@ -659,7 +671,10 @@
659671 echo "Test files: ${{ steps.vscode-get-test-file-matrix.outputs.test_file_matrix }}"
660672
661673 vscode-package-extension:
662- runs-on: ubuntu-latest
674+ runs-on: ${{ matrix.os }}
675+ strategy:
676+ matrix:
677+ os: [ubuntu-latest, macos-latest]
663678 needs:
664679 [
665680 install-vscode,
@@ -716,7 +731,7 @@
716731 - name: Upload build artifact
717732 uses: actions/upload-artifact@v4
718733 with:
719- name: vscode-extension-build
734+ name: vscode-extension-build-${{ runner.os }}
720735 path: extensions/vscode/build
721736
722737 vscode-download-e2e-dependencies:
@@ -812,7 +827,7 @@
812827 - name: Download build artifact
813828 uses: actions/download-artifact@v4
814829 with:
815- name: vscode-extension-build
830+ name: vscode-extension-build-Linux
816831 path: extensions/vscode/build
817832
818833 - name: Download e2e dependencies
added scripts/oneper +267 −0
@@ -0,0 +1,267 @@
1+#!/usr/bin/env bash
2+set -e
3+
4+# oneper - Install Continue VS Code extension from PR builds or latest pre-release
5+# Usage:
6+# oneper install --pr X - Install VSIX from PR number X
7+# oneper install --latest - Install latest pre-release from marketplace
8+
9+REPO="continuedev/continue"
10+ONEPER_DIR="$HOME/.continue/.utils/oneper"
11+
12+show_help() {
13+ echo "oneper - Install Continue VS Code extension from PR builds or latest pre-release"
14+ echo ""
15+ echo "Usage: oneper <command> [options]"
16+ echo " oneper -h | --help"
17+ echo ""
18+ echo "Commands:"
19+ echo " install --pr <number> [--platform <platform>]"
20+ echo " Download and install VSIX from specified PR number"
21+ echo " Platform options: macos, linux (default: macos)"
22+ echo " install --latest Install latest pre-release from VS Code marketplace"
23+ echo " clean Remove all downloaded VSIX files from oneper cache"
24+ echo ""
25+ echo "Options:"
26+ echo " -h, --help Show this help message"
27+ echo " --platform <platform> Specify platform for PR builds (macos, linux)"
28+ echo ""
29+ echo "Examples:"
30+ echo " oneper install --pr 123 # Install macOS VSIX from PR #123"
31+ echo " oneper install --pr 123 --platform linux # Install Linux VSIX from PR #123"
32+ echo " oneper install --latest # Install latest pre-release"
33+ echo " oneper clean # Clear cached VSIX files"
34+ echo " oneper -h # Show help"
35+ echo ""
36+ echo "VSIX files are cached in: ~/.continue/.utils/oneper/"
37+}
38+
39+check_dependencies() {
40+ if ! command -v gh &> /dev/null; then
41+ echo "❌ GitHub CLI (gh) is required but not installed."
42+ echo " Install with: brew install gh"
43+ exit 1
44+ fi
45+
46+ if ! command -v code &> /dev/null; then
47+ echo "❌ VS Code CLI (code) is required but not installed."
48+ echo " Install VS Code and ensure 'code' command is in PATH"
49+ exit 1
50+ fi
51+
52+}
53+
54+ensure_oneper_dir() {
55+ if [ ! -d "$ONEPER_DIR" ]; then
56+ echo "📁 Creating oneper directory: $ONEPER_DIR"
57+ mkdir -p "$ONEPER_DIR"
58+ fi
59+}
60+
61+install_from_pr() {
62+ local pr_number=$1
63+ local platform=${2:-"macos"} # Default to macOS
64+
65+ if [ -z "$pr_number" ]; then
66+ echo "❌ PR number is required"
67+ show_help
68+ exit 1
69+ fi
70+
71+ # Map platform names to GitHub runner OS names
72+ local artifact_suffix
73+ case "$platform" in
74+ "macos")
75+ artifact_suffix="macOS"
76+ ;;
77+ "linux")
78+ artifact_suffix="Linux"
79+ ;;
80+ *)
81+ echo "❌ Unknown platform: $platform"
82+ echo " Supported platforms: macos, linux"
83+ exit 1
84+ ;;
85+ esac
86+
87+ echo "🔍 Getting branch name for PR #$pr_number..."
88+
89+ # First get the branch name for the PR
90+ local branch_name=$(gh pr view "$pr_number" --repo "$REPO" --json headRefName --jq '.headRefName')
91+
92+ if [ -z "$branch_name" ]; then
93+ echo "❌ Could not find PR #$pr_number"
94+ exit 1
95+ fi
96+
97+ echo "🔍 Finding latest workflow run for branch: $branch_name..."
98+
99+ # Get the latest successful workflow run for the branch
100+ local run_id=$(gh run list \
101+ --repo "$REPO" \
102+ --workflow="pr_checks.yaml" \
103+ --branch="$branch_name" \
104+ --json databaseId,status,conclusion \
105+ --jq ".[] | select(.status == \"completed\" and .conclusion == \"success\") | .databaseId" \
106+ | head -1)
107+
108+ if [ -z "$run_id" ]; then
109+ echo "❌ No successful workflow run found for PR #$pr_number"
110+ echo " Make sure the PR exists and has a successful CI run"
111+ exit 1
112+ fi
113+
114+ echo "✅ Found workflow run: $run_id"
115+ echo "📥 Downloading vscode-extension-build-$artifact_suffix artifact..."
116+
117+ # Create temporary directory for download
118+ local temp_dir=$(mktemp -d)
119+
120+ # Download the artifact
121+ if ! gh run download "$run_id" \
122+ --repo "$REPO" \
123+ --name "vscode-extension-build-$artifact_suffix" \
124+ --dir "$temp_dir"; then
125+ echo "❌ Failed to download artifact vscode-extension-build-$artifact_suffix"
126+ echo " Make sure the workflow run completed successfully for $platform"
127+ rm -rf "$temp_dir"
128+ exit 1
129+ fi
130+
131+ # Find the VSIX file in the downloaded artifact
132+ local vsix_file=$(find "$temp_dir" -name "*.vsix" | head -1)
133+
134+ if [ -z "$vsix_file" ]; then
135+ echo "❌ No VSIX file found in artifact"
136+ rm -rf "$temp_dir"
137+ exit 1
138+ fi
139+
140+ # Extract version from the original VSIX filename (e.g., continue-1.1.66.vsix -> 1.1.66)
141+ local original_filename=$(basename "$vsix_file")
142+ local version=$(echo "$original_filename" | sed 's/continue-\(.*\)\.vsix/\1/')
143+
144+ if [ -z "$version" ]; then
145+ echo "⚠️ Could not extract version from filename: $original_filename"
146+ version="unknown"
147+ fi
148+
149+ # Create new VSIX name with version and PR number
150+ local target_path="$ONEPER_DIR/continue-${version}-${pr_number}.vsix"
151+
152+ # Check if file already exists and notify about overwrite
153+ if [ -f "$target_path" ]; then
154+ echo "⚠️ Overwriting existing VSIX: $target_path"
155+ fi
156+
157+ echo "📦 Moving VSIX to: $target_path"
158+ mv "$vsix_file" "$target_path"
159+
160+ # Clean up temp directory
161+ rm -rf "$temp_dir"
162+
163+ # Install the extension
164+ echo "🚀 Installing VS Code extension..."
165+ if code --install-extension "$target_path"; then
166+ echo "✅ Successfully installed Continue extension from PR #$pr_number"
167+ echo "📄 VSIX file saved to: $target_path"
168+ echo ""
169+ echo "💡 To use the new extension version, reload your VS Code window:"
170+ echo " • Press Ctrl+Shift+P (Cmd+Shift+P on Mac)"
171+ echo " • Type 'Developer: Reload Window' and press Enter"
172+ echo " • Or restart VS Code entirely"
173+ else
174+ echo "❌ Failed to install extension"
175+ exit 1
176+ fi
177+}
178+
179+install_latest() {
180+ echo "🚀 Installing latest pre-release Continue extension..."
181+ if code --install-extension --pre-release Continue.continue; then
182+ echo "✅ Successfully installed latest pre-release Continue extension"
183+ echo ""
184+ echo "💡 To use the new extension version, reload your VS Code window:"
185+ echo " • Press Ctrl+Shift+P (Cmd+Shift+P on Mac)"
186+ echo " • Type 'Developer: Reload Window' and press Enter"
187+ echo " • Or restart VS Code entirely"
188+ else
189+ echo "❌ Failed to install extension"
190+ exit 1
191+ fi
192+}
193+
194+clean_cache() {
195+ if [ ! -d "$ONEPER_DIR" ]; then
196+ echo "📁 Oneper cache directory doesn't exist: $ONEPER_DIR"
197+ return 0
198+ fi
199+
200+ local file_count=$(find "$ONEPER_DIR" -name "*.vsix" | wc -l | tr -d ' ')
201+
202+ if [ "$file_count" -eq 0 ]; then
203+ echo "✨ Oneper cache is already empty"
204+ return 0
205+ fi
206+
207+ echo "🧹 Removing $file_count VSIX file(s) from oneper cache..."
208+ rm -f "$ONEPER_DIR"/*.vsix
209+
210+ echo "✅ Oneper cache cleared successfully"
211+ echo "📁 Cache directory: $ONEPER_DIR"
212+}
213+
214+main() {
215+ if [ $# -eq 0 ]; then
216+ show_help
217+ exit 1
218+ fi
219+
220+ # Handle help flags first
221+ case "$1" in
222+ "-h"|"--help")
223+ show_help
224+ exit 0
225+ ;;
226+ esac
227+
228+ check_dependencies
229+ ensure_oneper_dir
230+
231+ case "$1" in
232+ "install")
233+ case "$2" in
234+ "--pr")
235+ # Parse PR number and optional platform
236+ local pr_number="$3"
237+ local platform="macos" # default
238+
239+ # Check if --platform is specified
240+ if [ "$4" = "--platform" ] && [ -n "$5" ]; then
241+ platform="$5"
242+ fi
243+
244+ install_from_pr "$pr_number" "$platform"
245+ ;;
246+ "--latest")
247+ install_latest
248+ ;;
249+ *)
250+ echo "❌ Unknown install option: $2"
251+ show_help
252+ exit 1
253+ ;;
254+ esac
255+ ;;
256+ "clean")
257+ clean_cache
258+ ;;
259+ *)
260+ echo "❌ Unknown command: $1"
261+ show_help
262+ exit 1
263+ ;;
264+ esac
265+}
266+
267+main "$@"
No newline at the end of the file