feat: Refactor service management scripts to use a unified dev script

- Added package.json to manage development scripts.
- Updated restart-services.ps1 to call the new dev script for starting services.
- Refactored start-admin.ps1, start-backend.ps1, start-frontend.ps1, and start-mcp.ps1 to utilize the dev script for starting respective services.
- Enhanced stop-services.ps1 to improve process termination logic by matching command patterns.
This commit is contained in:
2026-03-29 21:36:13 +08:00
parent 84f82c2a7e
commit 92a85eef20
137 changed files with 14181 additions and 2691 deletions

View File

@@ -8,34 +8,7 @@ param(
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$mcpDir = Join-Path $repoRoot "mcp-server"
$devScript = Join-Path $repoRoot "dev.ps1"
if (-not (Test-Path $mcpDir)) {
throw "MCP server directory not found: $mcpDir"
}
Push-Location $mcpDir
try {
if ($Install -or -not (Test-Path (Join-Path $mcpDir "node_modules"))) {
Write-Host "[mcp] Installing dependencies..." -ForegroundColor Cyan
npm install
if ($LASTEXITCODE -ne 0) {
throw "npm install failed"
}
}
$env:TERMI_MCP_API_KEY = $ApiKey
$env:TERMI_BACKEND_API_BASE = $BackendApiBase
$env:TERMI_MCP_PORT = "$Port"
Write-Host "[mcp] Backend API base set to $BackendApiBase" -ForegroundColor Cyan
Write-Host "[mcp] Starting MCP server on port $Port..." -ForegroundColor Green
npm run start
if ($LASTEXITCODE -ne 0) {
throw "npm run start failed"
}
}
finally {
Pop-Location
}
& $devScript -Only mcp -Install:$Install -McpApiKey $ApiKey -McpBackendApiBase $BackendApiBase -McpPort $Port
exit $LASTEXITCODE