mirror of
https://github.com/pengzhile/cocopilot.git
synced 2025-01-19 08:25:52 +08:00
add support for vscodium
This commit is contained in:
parent
63a1aa5134
commit
7f2c2247b7
40
vscodium.bat
Normal file
40
vscodium.bat
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
set extensions_dir=%userprofile%\.vscode-oss\extensions
|
||||||
|
if not exist "%extensions_dir%" (
|
||||||
|
echo ERROR: VSCodium extensions directory not found!
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
for /f "tokens=*" %%a in ('dir /b /ad "%extensions_dir%" ^| findstr /r /c:"^github\.copilot-[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$"') do (
|
||||||
|
set copilot_dir=%%a
|
||||||
|
goto :found
|
||||||
|
)
|
||||||
|
|
||||||
|
echo ERROR: Copilot extension not found!
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:found
|
||||||
|
set copilot_dir=%extensions_dir%\%copilot_dir%
|
||||||
|
set extension_file=%copilot_dir%\dist\extension.js
|
||||||
|
if not exist "%extension_file%" (
|
||||||
|
echo ERROR: Copilot extension entry file not found!
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo please be patient...
|
||||||
|
|
||||||
|
set tmp_file=%copilot_dir%\dist\extension.js.tmp
|
||||||
|
(
|
||||||
|
echo process.env.CODESPACES="true";process.env.GITHUB_TOKEN="ghu_ThisIsARealFreeCopilotKeyByCoCopilot";process.env.GITHUB_SERVER_URL="https://github.com";process.env.GITHUB_API_URL="https://api.cocopilot.org";
|
||||||
|
) > "%tmp_file%"
|
||||||
|
|
||||||
|
type "%extension_file%" >> "%tmp_file%"
|
||||||
|
move "%tmp_file%" "%extension_file%" > nul
|
||||||
|
|
||||||
|
echo done. please restart your vscodium.
|
||||||
|
pause
|
29
vscodium.sh
Executable file
29
vscodium.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
EXTENSIONS_DIR="$HOME/.vscode-oss/extensions"
|
||||||
|
if [ ! -d "$EXTENSIONS_DIR" ]; then
|
||||||
|
echo "ERROR: VSCodium extensions directory not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
COPILOT_DIR=$(ls -lt "$EXTENSIONS_DIR" | grep '^d' | awk '{print $9}' | grep -E '^github\.copilot-[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1)
|
||||||
|
if [ -z "$COPILOT_DIR" ]; then
|
||||||
|
echo "ERROR: Copilot extension not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
COPILOT_DIR="$EXTENSIONS_DIR/$COPILOT_DIR"
|
||||||
|
EXTENSION_FILE="$COPILOT_DIR/dist/extension.js"
|
||||||
|
if [ ! -f "$EXTENSION_FILE" ]; then
|
||||||
|
echo "ERROR: Copilot extension entry file not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMP_FILE="$COPILOT_DIR/dist/extension.js.tmp"
|
||||||
|
echo 'process.env.CODESPACES="true";process.env.GITHUB_TOKEN="ghu_ThisIsARealFreeCopilotKeyByCoCopilot";process.env.GITHUB_SERVER_URL="https://github.com";process.env.GITHUB_API_URL="https://api.cocopilot.org";' > "$TMP_FILE"
|
||||||
|
cat "$EXTENSION_FILE" >> "$TMP_FILE"
|
||||||
|
mv "$TMP_FILE" "$EXTENSION_FILE"
|
||||||
|
|
||||||
|
echo 'done. please restart your vscodium.'
|
Loading…
Reference in New Issue
Block a user