Repository navigation
Expand file tree
/
Copy pathupdate.bat
More file actions
143 lines (126 loc) · 4.55 KB
/
Copy pathupdate.bat
File metadata and controls
143 lines (126 loc) · 4.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
@echo off
setlocal EnableExtensions
chcp 65001 >nul
title VCPToolBox Global Updater
REM Always run from the repository root where this script is located.
cd /d "%~dp0" || goto :fail_directory
echo ============================================================
echo VCPToolBox Global Updater
echo ============================================================
echo.
call :check_command git "Git"
if errorlevel 1 goto :fail
call :check_command node "Node.js"
if errorlevel 1 goto :fail
call :check_command npm "npm"
if errorlevel 1 goto :fail
call :check_command cargo "Rust Cargo"
if errorlevel 1 goto :fail
call :check_command rustc "Rust compiler"
if errorlevel 1 goto :fail
git rev-parse --is-inside-work-tree >nul 2>&1
if errorlevel 1 (
echo [ERROR] This script is not running inside a Git repository.
goto :fail
)
REM Discard local tracked modifications in AdminPanel-Vue/dist before pulling
git checkout -- AdminPanel-Vue/dist >nul 2>&1
echo [1/8] Pulling latest source code with fast-forward only...
git pull --ff-only
if errorlevel 1 (
echo [ERROR] Git pull failed.
echo Resolve local changes, branch divergence, or network issues first.
goto :fail
)
echo [OK] Source code updated.
echo.
echo [2/8] Installing/updating root Node.js dependencies...
call npm install --no-audit --no-fund
if errorlevel 1 (
echo [ERROR] Root npm install failed.
goto :fail
)
echo [OK] Root Node.js dependencies updated.
echo.
echo [3/8] Installing/updating Vexus build dependencies...
pushd "rust-vexus-lite"
if errorlevel 1 (
echo [ERROR] Directory not found: rust-vexus-lite
goto :fail
)
call npm install --no-audit --no-fund
if errorlevel 1 (
popd
echo [ERROR] Vexus npm install failed.
goto :fail
)
popd
echo [OK] Vexus build dependencies updated.
echo.
echo [4/8] Building Rust Vexus vector database module...
pushd "rust-vexus-lite"
if errorlevel 1 (
echo [ERROR] Directory not found: rust-vexus-lite
goto :fail
)
call npm run build
if errorlevel 1 (
popd
echo [ERROR] Vexus build failed.
goto :fail
)
popd
echo [OK] Rust Vexus module built.
echo.
echo [5/8] Building DailyNoteSearcher Rust module...
call npm run build:daily-note-searcher
if errorlevel 1 (
echo [ERROR] DailyNoteSearcher build failed.
goto :fail
)
echo [OK] DailyNoteSearcher built and deployed.
echo.
echo [6/8] Building CodeSearcher Rust module...
call npm run build:code-searcher
if errorlevel 1 (
echo [ERROR] CodeSearcher build failed.
goto :fail
)
echo [OK] CodeSearcher built and deployed.
echo.
echo [7/8] Verifying and building AdminPanel-Vue frontend...
call npm run ensure:admin
if errorlevel 1 (
echo [ERROR] AdminPanel-Vue ensure/build failed.
goto :fail
)
echo [OK] AdminPanel-Vue frontend verified.
echo.
echo [8/8] Checking config.env against config.env.example...
node -e "const fs=require('fs');if(!fs.existsSync('config.env.example')){console.log('[SKIP] config.env.example not found.');}else if(!fs.existsSync('config.env')){console.log('[WARN] config.env not found. Please copy config.env.example to config.env.');}else{const parse=p=>new Set((fs.readFileSync(p,'utf8').match(/^[ \t]*([A-Za-z_][A-Za-z0-9_]*)[ \t]*=/gm)||[]).map(s=>s.split('=')[0].trim()));const ex=parse('config.env.example'),cur=parse('config.env');const miss=[...ex].filter(k=>!cur.has(k));if(miss.length){console.log('[WARN] Keys in config.env.example but missing from your config.env ('+miss.length+'):');console.log(' '+miss.join(', '));console.log(' (Tip only: review config.env.example and sync needed keys manually.)');}else{console.log('[OK] config.env contains all active keys from config.env.example.');}}"
echo.
echo ============================================================
echo [SUCCESS] VCPToolBox update completed successfully.
echo ============================================================
goto :success
:check_command
where %~1 >nul 2>&1
if errorlevel 1 (
echo [ERROR] Required command not found: %~2 ^(%~1^)
echo Install it and ensure it is available in PATH.
exit /b 1
)
echo [OK] Found %~2.
exit /b 0
:fail_directory
echo [ERROR] Unable to enter the script directory: %~dp0
:fail
echo.
echo ============================================================
echo [FAILED] Update stopped. Review the error message above.
echo ============================================================
if /I not "%~1"=="--no-pause" pause
exit /b 1
:success
if /I not "%~1"=="--no-pause" pause
exit /b 0