Skip to content

fix(issue-43): add permission checks, port detection, and cleanup scripts#55

Merged
SonicBotMan merged 1 commit into
mainfrom
fix/issue-43-permission-and-port-checks
Mar 18, 2026
Merged

fix(issue-43): add permission checks, port detection, and cleanup scripts#55
SonicBotMan merged 1 commit into
mainfrom
fix/issue-43-permission-and-port-checks

Conversation

@SonicBotMan

Copy link
Copy Markdown
Owner

🐛 Bug Fix

Problem

`start.bat` silently fails or provides poor user experience in the following scenarios:

1. No Admin Privilege Check

  • On Windows 10/11, standard users may have write permission issues
  • Script provides no warning

2. No Port Conflict Detection

  • `GATEWAY_PORT=18789` may be occupied
  • `LLM_PORT=18080` may be occupied
  • Script fails silently

3. No Sensitive File Cleanup

  • API Keys, tokens, logs remain on disk
  • Risk when plugging into other computers

Solution

1. Permission Detection

  • start.sh: Add admin check for Windows (Git Bash/MSYS2)
  • start.bat: Add admin check with user prompt
  • Show warning if not running as Administrator
  • Allow user to continue anyway

2. Port Conflict Detection

  • start.sh: Check `GATEWAY_PORT` and `LLM_PORT` conflicts
  • start.bat: Check port conflicts with `netstat`
  • Show helpful messages when conflicts detected
  • Allow user to continue anyway

3. Cleanup Scripts

  • cleanup.sh: New cleanup script for Linux/macOS
    • Level 1: Light cleanup (logs, PIDs)
    • Level 2: Deep cleanup (configs, tokens, backups)
  • cleanup.bat: New cleanup script for Windows
    • Same functionality as bash version
    • Interactive menu with 3 options

Testing

  • Manual testing on both Windows and Linux
  • Port conflict detection tested
  • Permission check tested

Impact

  • User Experience: Better error messages, no silent failures
  • Security: Zero-trace design for portable use
  • Reliability: Fewer support questions

Fixes #43

…ipts

### Changes

**1. Permission Detection**
- start.sh: Add admin check for Windows (Git Bash/MSYS2)
- start.bat: Add admin check with user prompt
- Show warning if not running as Administrator
- Allow user to continue anyway

**2. Port Conflict Detection**
- start.sh: Check GATEWAY_PORT and LLM_PORT conflicts
- start.bat: Check port conflicts with netstat
- Show helpful messages when conflicts detected
- Allow user to continue anyway

**3. Cleanup Scripts**
- cleanup.sh: New cleanup script for Linux/macOS
  - Level 1: Light cleanup (logs, PIDs)
  - Level 2: Deep cleanup (configs, tokens, backups)
- cleanup.bat: New cleanup script for Windows
  - Same functionality as bash version
  - Interactive menu with 3 options

### Testing
- Manual testing on both Windows and Linux
- Port conflict detection tested
- Permission check tested

Fixes #43
@SonicBotMan SonicBotMan merged commit 24b4883 into main Mar 18, 2026
@SonicBotMan SonicBotMan deleted the fix/issue-43-permission-and-port-checks branch March 18, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[体验优化] 缺少管理员权限检测、端口冲突检测和敏感文件清除机制

1 participant