Files
AX-Copilot-Codex/build.bat
lacvet 8cb08576d5 AX Agent 도구·스킬 정합성 재구성 및 실행 품질 보강
변경 목적:
- AX Agent의 도구 이름, 내부 설정, 스킬 정책, 실행 루프 사이의 불일치를 줄이고 전체 동작 품질을 높인다.
- claw-code 수준의 일관된 동작 품질을 참고하되 AX 구조에 맞는 고유한 카탈로그·정규화 레이어로 재구성한다.

핵심 수정사항:
- 도구 canonical id, legacy alias, 탭 노출, 설정 카테고리, read-only 분류를 중앙 카탈로그로 통합했다.
- ToolRegistry, AgentLoopService, 병렬 실행 분류, 권한 처리, 훅 처리, 스킬 allowed-tools 해석이 같은 이름 체계를 사용하도록 정리했다.
- Agent 설정/일반 설정/도움말의 도구 카드와 훅 편집기, 스킬 설명을 현재 런타임 구조에 맞게 갱신했다.
- 컨텍스트 압축, intent gate, spawn agents, session learning, model prompt adapter, workspace context 관련 변경과 테스트 추가를 함께 반영했다.
- 문서 이력과 비교/로드맵 문서를 최신 상태로 갱신했다.

검증 결과:
- dotnet build src/AxCopilot/AxCopilot.csproj -c Release -v minimal -p:OutputPath=bin\verify_toolcat\ -p:IntermediateOutputPath=obj\verify_toolcat\ : 경고 0 / 오류 0
- dotnet test src/AxCopilot.Tests/AxCopilot.Tests.csproj -c Release -v minimal --filter AgentToolCatalogTests -p:OutputPath=bin\verify_toolcat_tests\ -p:IntermediateOutputPath=obj\verify_toolcat_tests\ : 통과 8
2026-04-14 17:52:46 +09:00

200 lines
5.8 KiB
Batchfile

@echo off
setlocal EnableExtensions
chcp 65001 >nul
set "ROOT=%~dp0"
pushd "%ROOT%" >nul
echo.
echo ========================================
echo AX Copilot - Build Script
echo ========================================
echo.
set "APP=%ROOT%src\AxCopilot\AxCopilot.csproj"
set "ENCRYPTOR=%ROOT%src\AxKeyEncryptor\AxKeyEncryptor.csproj"
set "INSTALLER=%ROOT%src\AxCopilot.Installer\AxCopilot.Installer.csproj"
set "INSTALLER_DIR=%ROOT%src\AxCopilot.Installer"
set "OUT=%ROOT%dist"
set "APP_OUT=%OUT%\AxCopilot"
set "ENCRYPTOR_OUT=%OUT%\AxKeyEncryptor"
set "PAYLOAD_ZIP=%INSTALLER_DIR%\payload.zip"
set "INSTALLER_EXE=%INSTALLER_DIR%\bin\Release\net48\AxCopilot_Setup.exe"
set "RUNTIME=win-x64"
set "OBFUSCATOR_EXE=%ROOT%tools\obfuscator\obfuscator.exe"
set "OBFUSCATOR_CONFIG=%ROOT%tools\obfuscator\AxCopilot.obfuscation.xml"
call :stop_process "AxCopilot" "AX Copilot"
if errorlevel 1 goto :fail_running
call :stop_process "AxCommander" "legacy AxCommander"
if errorlevel 1 goto :fail_running
if exist "%OUT%" rd /s /q "%OUT%" 2>nul
mkdir "%OUT%" || goto :fail_dist
mkdir "%APP_OUT%" || goto :fail_dist
mkdir "%ENCRYPTOR_OUT%" || goto :fail_dist
if exist "%PAYLOAD_ZIP%" del /q "%PAYLOAD_ZIP%" 2>nul
echo [1/5] Building main app (self-contained %RUNTIME%)...
dotnet publish "%APP%" ^
-c Release ^
-r %RUNTIME% ^
--self-contained true ^
-o "%APP_OUT%" ^
--nologo ^
-v minimal ^
-p:DebugType=None ^
-p:DebugSymbols=false ^
-p:CopyOutputSymbolsToPublishDirectory=false ^
-p:EnableSourceLink=false ^
-p:PublishSingleFile=true ^
-p:EnableCompressionInSingleFile=true ^
-p:IncludeNativeLibrariesForSelfExtract=true ^
-p:PublishReadyToRun=true
if errorlevel 1 goto :fail_app
echo OK - %APP_OUT%
echo.
echo [2/5] Checking obfuscation / anti-decompile status...
if exist "%OBFUSCATOR_EXE%" (
if exist "%OBFUSCATOR_CONFIG%" (
echo Optional obfuscator found.
echo Running: "%OBFUSCATOR_EXE%"
"%OBFUSCATOR_EXE%" "%OBFUSCATOR_CONFIG%" "%APP_OUT%"
if errorlevel 1 goto :fail_obfuscation
echo OK - obfuscation step completed
) else (
echo WARNING - no external obfuscator configured.
echo Current protection is limited to symbol/source metadata removal only.
)
) else (
echo WARNING - no external obfuscator configured.
echo Current protection is limited to symbol/source metadata removal only.
)
echo.
echo [3/5] Building AxKeyEncryptor...
dotnet publish "%ENCRYPTOR%" ^
-c Release ^
-o "%ENCRYPTOR_OUT%" ^
--self-contained false ^
--nologo ^
-v minimal ^
-p:DebugType=None ^
-p:DebugSymbols=false
if errorlevel 1 goto :fail_encryptor
echo OK - %ENCRYPTOR_OUT%
echo.
echo [4/5] Creating installer payload ZIP...
powershell -NoProfile -Command "Compress-Archive -Path '%APP_OUT%\*' -DestinationPath '%PAYLOAD_ZIP%' -Force"
if errorlevel 1 goto :fail_payload
if not exist "%PAYLOAD_ZIP%" goto :fail_payload
echo OK - %PAYLOAD_ZIP%
echo.
echo [5/5] Building installer (.NET Framework 4.8)...
dotnet build "%INSTALLER%" -c Release --nologo -v minimal
if errorlevel 1 goto :fail_installer
if not exist "%INSTALLER_EXE%" goto :fail_installer_copy
copy /Y "%INSTALLER_EXE%" "%OUT%\" >nul
if errorlevel 1 goto :fail_installer_copy
for %%F in ("%OUT%\AxCopilot_Setup.exe") do echo OK - AxCopilot_Setup.exe (%%~zF bytes)
echo.
echo [Cleanup] Removing debug and metadata files from dist...
call :clean_publish_artifacts "%OUT%"
call :clean_publish_artifacts "%APP_OUT%"
call :clean_publish_artifacts "%ENCRYPTOR_OUT%"
if exist "%PAYLOAD_ZIP%" del /q "%PAYLOAD_ZIP%" 2>nul
echo OK - cleaned
echo.
echo ========================================
echo Build Complete!
echo ========================================
echo.
echo %APP_OUT% Main app
echo %ENCRYPTOR_OUT% Settings Encryptor
echo %OUT%\AxCopilot_Setup.exe Installer
echo.
echo Note:
echo - Release/self-contained single-file publish applied
echo - ReadyToRun + compressed single-file bundle enabled
echo - PDB/XML/debug metadata removed from dist output
echo - External obfuscator is only applied when tools\obfuscator is configured
echo.
popd >nul
exit /b 0
:stop_process
set "PROC_NAME=%~1"
set "DISPLAY_NAME=%~2"
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$name='%PROC_NAME%';" ^
"$display='%DISPLAY_NAME%';" ^
"$procs = Get-Process -Name $name -ErrorAction SilentlyContinue;" ^
"if (-not $procs) { exit 0 }" ^
"Write-Host ('[0] Stopping ' + $display + '...');" ^
"$imageName = $name + '.exe';" ^
"foreach ($proc in $procs) {" ^
" try { if ($proc.MainWindowHandle -ne 0) { [void]$proc.CloseMainWindow() } } catch { }" ^
"}" ^
"Start-Sleep -Seconds 2;" ^
"& taskkill /IM $imageName /T /F > $null 2> $null;" ^
"Start-Sleep -Seconds 2;" ^
"$stillRunning = Get-Process -Name $name -ErrorAction SilentlyContinue;" ^
"if ($stillRunning) {" ^
" Write-Host ('[FAILED] Could not stop ' + $display + '. Access may be denied or the app may be running with higher privileges.') -ForegroundColor Red;" ^
" exit 1" ^
"}" ^
"exit 0"
if errorlevel 1 exit /b 1
exit /b 0
:clean_publish_artifacts
if not exist "%~1" exit /b 0
del /q "%~1\*.pdb" 2>nul
del /q "%~1\*.xml" 2>nul
del /q "%~1\*.deps.json" 2>nul
del /q "%~1\*.runtimeconfig.json" 2>nul
exit /b 0
:fail_dist
echo [FAILED] dist 폴더 생성 실패
goto :end_fail
:fail_app
echo [FAILED] main app publish 실패
goto :end_fail
:fail_obfuscation
echo [FAILED] obfuscation 단계 실패
goto :end_fail
:fail_encryptor
echo [FAILED] AxKeyEncryptor publish 실패
goto :end_fail
:fail_payload
echo [FAILED] payload.zip 생성 실패
goto :end_fail
:fail_installer
echo [FAILED] installer build 실패
goto :end_fail
:fail_installer_copy
echo [FAILED] installer exe 복사 실패
goto :end_fail
:fail_running
echo [FAILED] 실행 중인 AX Copilot 프로세스를 종료할 수 없습니다
goto :end_fail
:end_fail
if exist "%PAYLOAD_ZIP%" del /q "%PAYLOAD_ZIP%" 2>nul
popd >nul
exit /b 1