Skip to content

Commit f08449f

Browse files
docs: enhance bug report template, update README navigation, and add CLI usage documentation.
1 parent f9e329b commit f08449f

4 files changed

Lines changed: 131 additions & 99 deletions

File tree

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Press '....'
1717
3. Scroll down to '....'
@@ -23,10 +23,24 @@ A clear and concise description of what you expected to happen.
2323
**Screenshots**
2424
If applicable, add screenshots to help explain your problem.
2525

26+
**Logs**
27+
Surge only writes log files when run with `--verbose`. To capture a log:
28+
29+
1. Reproduce the bug with the `--verbose` flag:
30+
```
31+
surge --verbose [your command]
32+
```
33+
2. The log file is written to:
34+
- **Linux:** `~/.local/state/surge/logs/`
35+
- **macOS:** `~/Library/Application Support/surge/logs/`
36+
- **Windows:** `%APPDATA%\surge\logs\`
37+
3. Attach the most recent `debug-*.log` file by dragging it into this issue, or paste relevant excerpts in a code block.
38+
2639
**Please complete the following information:**
27-
- OS: [e.g. iOS]
28-
- Version [e.g. 22]
29-
- Installed From: [e.g. Brew]
40+
41+
- OS: [e.g. Windows 11 / macOS 14 / Ubuntu 24.04]
42+
- Surge Version: [e.g. 1.2.0 — run `surge --version`]
43+
- Installed From: [e.g. Brew / GitHub Release / built from source]
3044

3145
**Additional context**
3246
Add any other context about the problem here.

‎README.md‎

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div align="center">
22

33
# Surge
4+
45
**Blazing fast TUI download manager built in Go for power users**
56

67
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/surge-downloader/surge)
@@ -10,8 +11,7 @@
1011
[![BuyMeACoffee](https://raw.githubusercontent.com/pachadotdev/buymeacoffee-badges/main/bmc-violet.svg)](https://www.buymeacoffee.com/surge.downloader)
1112
[![Stars](https://img.shields.io/github/stars/surge-downloader/surge?style=social)](https://github.com/surge-downloader/surge/stargazers)
1213

13-
14-
[Installation](#installation) • [Usage](#usage) • [Benchmarks](#benchmarks) • [Extension](#browser-extension)
14+
[Installation](#installation) • [Usage](#usage) • [Benchmarks](#benchmarks) • [Extension](#browser-extension) • [Settings](docs/SETTINGS.md) • [CLI Reference](docs/USAGE.md)
1515

1616
</div>
1717

@@ -51,30 +51,30 @@ If Surge saves you time, consider supporting the development! Donations go direc
5151

5252
[**☕ Buy us a coffee**](https://www.buymeacoffee.com/surge.downloader)
5353

54-
*Totally optional—your stars, issues, and contributions already mean the world to us! :)*
54+
_Totally optional—your stars, issues, and contributions already mean the world to us! :)_
5555

5656
---
5757

5858
## Installation
5959

6060
Surge is available on multiple platforms. Choose the method that works best for you.
6161

62-
| Platform / Method | Command / Instructions | Notes |
63-
| :--- | :--- | :--- |
64-
| **Prebuilt Binary** | [Download from Releases](https://github.com/surge-downloader/surge/releases/latest) | Easiest method. Just download and run. |
65-
| **Arch Linux (AUR)** | `yay -S surge` | Managed via AUR. |
66-
| **macOS / Linux (Homebrew)** | `brew install surge-downloader/tap/surge` | Recommended for Mac/Linux users. |
67-
| **Windows (Winget)** | `winget install surge-downloader.surge` | Recommended for Windows users. |
68-
| **Dockerfile** | [See instructions](#4-server-mode-with-docker-compose) | Run Surge in server mode with Docker Compose
69-
| **Go Install** | `go install github.com/surge-downloader/surge@latest` | Requires Go 1.21+. |
62+
| Platform / Method | Command / Instructions | Notes |
63+
| :--------------------------- | :---------------------------------------------------------------------------------- | :------------------------------------------- |
64+
| **Prebuilt Binary** | [Download from Releases](https://github.com/surge-downloader/surge/releases/latest) | Easiest method. Just download and run. |
65+
| **Arch Linux (AUR)** | `yay -S surge` | Managed via AUR. |
66+
| **macOS / Linux (Homebrew)** | `brew install surge-downloader/tap/surge` | Recommended for Mac/Linux users. |
67+
| **Windows (Winget)** | `winget install surge-downloader.surge` | Recommended for Windows users. |
68+
| **Dockerfile** | [See instructions](#4-server-mode-with-docker-compose) | Run Surge in server mode with Docker Compose |
69+
| **Go Install** | `go install github.com/surge-downloader/surge@latest` | Requires Go 1.21+. |
7070

7171
---
7272

7373
## Usage
7474

7575
Surge has two main modes: **TUI (Interactive)** and **Server (Headless)**.
7676

77-
For a comprehensive list of all commands, flags, and configuration options, please refer to the **[Detailed Settings & Configuration Guide](docs/SETTINGS.md)**.
77+
For a full reference, see the **[Settings & Configuration Guide](docs/SETTINGS.md)** and the **[CLI Usage Guide](docs/USAGE.md)**.
7878

7979
### 1. Interactive TUI Mode
8080

@@ -148,30 +148,30 @@ Environment variable fallbacks:
148148

149149
Download the compose file and start the container:
150150

151-
```bash
152-
wget https://raw.githubusercontent.com/surge-downloader/surge/refs/heads/main/docker/compose.yml
153-
docker compose up -d
154-
```
151+
```bash
152+
wget https://raw.githubusercontent.com/surge-downloader/surge/refs/heads/main/docker/compose.yml
153+
docker compose up -d
154+
```
155155

156156
Get the API token:
157157

158-
```bash
159-
docker compose exec surge surge token
160-
```
161-
162-
Save this token - you'll need it to authenticate API requests and connect remotely.
158+
```bash
159+
docker compose exec surge surge token
160+
```
161+
162+
Save this token - you'll need it to authenticate API requests and connect remotely.
163163

164164
Check downloads/API availability:
165165

166-
```bash
167-
docker compose exec surge surge ls
168-
```
166+
```bash
167+
docker compose exec surge surge ls
168+
```
169169

170170
View logs:
171171

172-
```bash
173-
docker compose logs -f surge
174-
```
172+
```bash
173+
docker compose logs -f surge
174+
```
175175

176176
---
177177

‎docs/SETTINGS.md‎

Lines changed: 42 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,64 @@
11
# Settings & Configuration
22

3-
This document provides a detailed overview of all configuration options and CLI commands available in Surge.
3+
This document covers all configuration options available in Surge. For CLI commands and flags, see [USAGE.md](USAGE.md).
44

55
## Configuration File
66

77
You can **access the settings in TUI** or if you prefer
88
from the `settings.json` file located in the application data directory:
9+
910
- **Windows:** `%APPDATA%\surge\settings.json`
1011
- **macOS:** `~/Library/Application Support/surge/settings.json`
1112
- **Linux:** `~/.config/surge/settings.json`
1213

13-
### General Settings
14-
| Key | Type | Description | Default |
15-
| :--- | :--- | :--- | :--- |
16-
| `default_download_dir` | string | Directory where new downloads are saved. If empty, defaults to `~/Downloads` or current directory. | `""` |
17-
| `warn_on_duplicate` | bool | Show a warning when adding a download that already exists in the list. | `true` |
18-
| `extension_prompt` | bool | Prompt for confirmation in the TUI when adding downloads via the browser extension. | `false` |
19-
| `auto_resume` | bool | Automatically resume paused downloads when Surge starts. | `false` |
20-
| `skip_update_check` | bool | Disable automatic check for new versions on startup. | `false` |
21-
| `clipboard_monitor` | bool | Watch the system clipboard for URLs and prompt to download them. | `true` |
22-
| `theme` | int | UI Theme (0=Adaptive, 1=Light, 2=Dark). | `0` |
23-
| `log_retention_count` | int | Number of recent log files to keep. | `5` |
24-
25-
### Connection Settings
26-
| Key | Type | Description | Default |
27-
| :--- | :--- | :--- | :--- |
28-
| `max_connections_per_host` | int | Maximum concurrent connections allowed to a single host (1-64). | `32` |
29-
| `max_concurrent_downloads` | int | Maximum number of downloads running simultaneously (requires restart). | `3` |
30-
| `user_agent` | string | Custom User-Agent string for HTTP requests. Leave empty for default. | `""` |
31-
| `proxy_url` | string | HTTP/HTTPS proxy URL (e.g., `http://127.0.0.1:8080`). Leave empty to use system settings. | `""` |
32-
| `sequential_download` | bool | Download file pieces in strict order (Streaming Mode). Useful for previewing media but may be slower. | `false` |
33-
| `min_chunk_size` | int64 | Minimum size of a download chunk in bytes (e.g., `2097152` for 2MB). | `2MB` |
34-
| `worker_buffer_size` | int | I/O buffer size per worker in bytes (e.g., `524288` for 512KB). | `512KB` |
35-
36-
### Performance Settings
37-
| Key | Type | Description | Default |
38-
| :--- | :--- | :--- | :--- |
39-
| `max_task_retries` | int | Number of times to retry a failed chunk before giving up. | `3` |
40-
| `slow_worker_threshold` | float | Restart workers slower than this fraction of the mean speed (0.0-1.0). | `0.3` |
41-
| `slow_worker_grace_period` | duration | Time to wait before checking a worker's speed (e.g., `5s`). | `5s` |
42-
| `stall_timeout` | duration | Restart workers that haven't received data for this duration (e.g., `3s`). | `3s` |
43-
| `speed_ema_alpha` | float | Exponential moving average smoothing factor for speed calculation (0.0-1.0). | `0.3` |
44-
45-
---
14+
## Directory Structure
4615

47-
## CLI Reference
16+
Surge follows OS conventions for storing its files. Below is a breakdown of every directory it uses and where to find it on each platform.
4817

49-
Surge provides a robust Command Line Interface for automation and scripting.
18+
| Directory | Purpose | Linux | macOS | Windows |
19+
| :---------- | :-------------------------------- | :--------------------------- | :------------------------------------------ | :---------------------- |
20+
| **Config** | `settings.json` | `~/.config/surge/` | `~/Library/Application Support/surge/` | `%APPDATA%\surge\` |
21+
| **State** | Database (`surge.db`), auth token | `~/.local/state/surge/` | `~/Library/Application Support/surge/` | `%APPDATA%\surge\` |
22+
| **Logs** | Timestamped `.log` files | `~/.local/state/surge/logs/` | `~/Library/Application Support/surge/logs/` | `%APPDATA%\surge\logs\` |
23+
| **Runtime** | PID file, port file, lock | `$XDG_RUNTIME_DIR/surge/`¹ | `$TMPDIR/surge-runtime/` | `%TEMP%\surge\` |
5024

51-
### Command Table
25+
> ¹ Falls back to `~/.local/state/surge/` when `$XDG_RUNTIME_DIR` is not set (e.g. Docker / headless).
5226
53-
| Command | What it does | Key flags | Notes |
54-
| :--- | :--- | :--- | :--- |
55-
| `surge [url]...` | Launches local TUI. Queues optional URLs. | `--batch, -b`<br>`--port, -p`<br>`--output, -o`<br>`--no-resume`<br>`--exit-when-done` | If `--host` is set, this becomes remote TUI mode. |
56-
| `surge server [url]...` | Launches headless server. Queues optional URLs. | `--batch, -b`<br>`--port, -p`<br>`--output, -o`<br>`--exit-when-done`<br>`--no-resume`<br>`--token` | Primary headless mode command. |
57-
| `surge connect <host:port>` | Launches TUI connected to remote server. | `--insecure-http` | Convenience alias for remote TUI usage. |
58-
| `surge add <url>...` | Queues downloads via CLI/API. | `--batch, -b`<br>`--output, -o` | Alias: `get`. |
59-
| `surge ls [id]` | Lists downloads, or shows one download detail. | `--json`<br>`--watch` | Alias: `l`. |
60-
| `surge pause <id>` | Pauses a download by ID/prefix. | `--all` | |
61-
| `surge resume <id>` | Resumes a paused download by ID/prefix. | `--all` | |
62-
| `surge rm <id>` | Removes a download by ID/prefix. | `--clean` | Alias: `kill`. |
63-
| `surge token` | Prints current API auth token. | None | Useful for remote clients. |
27+
> **Note:** On Linux, `$XDG_CONFIG_HOME` / `$XDG_STATE_HOME` are respected if set; the paths above show the defaults.
6428
65-
### Server Subcommands (Compatibility)
29+
---
6630

67-
| Command | What it does |
68-
| :--- | :--- |
69-
| `surge server start [url]...` | Legacy equivalent of `surge server [url]...`. |
70-
| `surge server stop` | Stops a running server process by PID file. |
71-
| `surge server status` | Prints running/not-running status from PID/port state. |
31+
### General Settings
7232

73-
### Global Flags
33+
| Key | Type | Description | Default |
34+
| :--------------------- | :----- | :------------------------------------------------------------------------------------------------- | :------ |
35+
| `default_download_dir` | string | Directory where new downloads are saved. If empty, defaults to `~/Downloads` or current directory. | `""` |
36+
| `warn_on_duplicate` | bool | Show a warning when adding a download that already exists in the list. | `true` |
37+
| `extension_prompt` | bool | Prompt for confirmation in the TUI when adding downloads via the browser extension. | `false` |
38+
| `auto_resume` | bool | Automatically resume paused downloads when Surge starts. | `false` |
39+
| `skip_update_check` | bool | Disable automatic check for new versions on startup. | `false` |
40+
| `clipboard_monitor` | bool | Watch the system clipboard for URLs and prompt to download them. | `true` |
41+
| `theme` | int | UI Theme (0=Adaptive, 1=Light, 2=Dark). | `0` |
42+
| `log_retention_count` | int | Number of recent log files to keep. | `5` |
7443

75-
These are persistent flags and can be used with all commands.
44+
### Connection Settings
7645

77-
| Flag | Description |
78-
| :--- | :--- |
79-
| `--host <host:port>` | Target server for TUI and CLI actions. |
80-
| `--token <token>` | Bearer token used for API requests. |
81-
| `--verbose, -v` | Enable verbose logging. |
46+
| Key | Type | Description | Default |
47+
| :------------------------- | :----- | :---------------------------------------------------------------------------------------------------- | :------ |
48+
| `max_connections_per_host` | int | Maximum concurrent connections allowed to a single host (1-64). | `32` |
49+
| `max_concurrent_downloads` | int | Maximum number of downloads running simultaneously (requires restart). | `3` |
50+
| `user_agent` | string | Custom User-Agent string for HTTP requests. Leave empty for default. | `""` |
51+
| `proxy_url` | string | HTTP/HTTPS proxy URL (e.g., `http://127.0.0.1:8080`). Leave empty to use system settings. | `""` |
52+
| `sequential_download` | bool | Download file pieces in strict order (Streaming Mode). Useful for previewing media but may be slower. | `false` |
53+
| `min_chunk_size` | int64 | Minimum size of a download chunk in bytes (e.g., `2097152` for 2MB). | `2MB` |
54+
| `worker_buffer_size` | int | I/O buffer size per worker in bytes (e.g., `524288` for 512KB). | `512KB` |
8255

83-
### Environment Variables
56+
### Performance Settings
8457

85-
| Variable | Description |
86-
| :--- | :--- |
87-
| `SURGE_HOST` | Default host when `--host` is not provided. |
88-
| `SURGE_TOKEN` | Default token when `--token` is not provided. |
58+
| Key | Type | Description | Default |
59+
| :------------------------- | :------- | :--------------------------------------------------------------------------- | :------ |
60+
| `max_task_retries` | int | Number of times to retry a failed chunk before giving up. | `3` |
61+
| `slow_worker_threshold` | float | Restart workers slower than this fraction of the mean speed (0.0-1.0). | `0.3` |
62+
| `slow_worker_grace_period` | duration | Time to wait before checking a worker's speed (e.g., `5s`). | `5s` |
63+
| `stall_timeout` | duration | Restart workers that haven't received data for this duration (e.g., `3s`). | `3s` |
64+
| `speed_ema_alpha` | float | Exponential moving average smoothing factor for speed calculation (0.0-1.0). | `0.3` |

0 commit comments

Comments
 (0)