Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 3 additions & 31 deletions .github/workflows/auto-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
# failing the job (they require a manual semver-major update).
npm audit || true

# ── Commit, push, PR to dev, then PR to main ──────────────────────────
# ── Commit, push, and open PR to dev ───────────────────────────────────
- name: Commit fix and open PR to dev
if: steps.audit.outputs.found == 'true' && steps.changes.outputs.has_changes == 'true'
env:
Expand All @@ -118,7 +118,7 @@ jobs:

git checkout -b "$BRANCH"
git add package.json package-lock.json
git commit -m "fix(deps): auto npm audit fix ${DATE}"
git commit -s -m "fix(deps): auto npm audit fix ${DATE}"
git push origin "$BRANCH"

gh pr create \
Expand All @@ -135,32 +135,4 @@ jobs:
- All checks passed: typecheck ✅ lint ✅ build ✅ tests ✅

### Next steps
This PR is set to auto-merge into \`dev\` once all required checks pass.
A follow-up PR from \`dev → main\` will be opened automatically after."

# Auto-merge into dev when all checks pass
gh pr merge "$BRANCH" --merge --auto

- name: Open PR from dev to main
if: steps.audit.outputs.found == 'true' && steps.changes.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
DATE=$(date +%Y%m%d)

# Wait for the dev merge to land before targeting main
sleep 30

gh pr create \
--base main \
--head dev \
--title "fix(deps): security audit fix (${DATE})" \
--body "## Security Audit Fix → main

Automatically opened after the audit fix was merged into \`dev\` and all CI checks passed.

See the dev PR for full details." \
|| echo "::notice::PR dev→main already open or dev is already up to date with main"

# Auto-merge into main when all checks pass
gh pr merge dev --merge --auto || true
Please review and merge this PR into \`dev\` manually."
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
branches: [main, dev]
pull_request:
branches: [main, dev]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: PR Review

on:
pull_request:
branches: [main, dev]
types: [opened, edited, synchronize, reopened]
pull_request_target:
branches: [main, dev]
types: [opened, edited, synchronize, reopened]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
pull-requests: write
contents: read
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,17 @@ leetcode config --lang sql
leetcode config --editor code
leetcode config --workdir ~/leetcode
leetcode config --repo https://github.com/username/leetcode-solutions.git

# Pick a color theme for the TUI (dark, light, or auto)
leetcode config --theme light
leetcode config --theme dark
leetcode config --theme auto
```

The `--theme` setting is workspace-scoped. `auto` (the default) probes the
terminal for its background color via OSC 11 and falls back to `COLORFGBG`,
then to `dark`, if the terminal doesn't reply.

## Folder Structure

Solution files are automatically organized by difficulty and category:
Expand Down
9 changes: 8 additions & 1 deletion docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ View or set configuration.
- `-e, --editor <editor>` - Set editor command
- `-w, --workdir <path>` - Set working directory for solutions
- `-r, --repo [url]` - Set or clear Git repository URL
- `-t, --theme <theme>` - Set TUI color theme (`dark`, `light`, or `auto`)
- `-i, --interactive` - Interactive configuration mode

**Examples**:
Expand All @@ -599,6 +600,12 @@ leetcode config --site leetcode.cn
# Set editor
leetcode config -e code
leetcode config --editor vim
leetcode config --editor zed

# Set TUI color theme
leetcode config --theme light
leetcode config --theme dark
leetcode config --theme auto

# Set working directory
leetcode config -w ~/leetcode
Expand All @@ -613,7 +620,7 @@ leetcode config -i
leetcode config --interactive

# Set multiple options
leetcode config -l cpp -e code -w ~/leetcode
leetcode config -l cpp -e code -w ~/leetcode --theme auto
```

---
Expand Down
10 changes: 10 additions & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,17 @@ leetcode config --editor zed

# Set Git repository
leetcode config -r https://github.com/myuser/leetcode-solutions.git

# Set TUI color theme (dark, light, or auto)
leetcode config --theme light
leetcode config --theme dark
leetcode config --theme auto
```

The `--theme` setting is workspace-scoped. `auto` (the default) probes the
terminal for its background color via OSC 11 and falls back to `COLORFGBG`,
then to `dark`, if the terminal doesn't reply.

## Settings

Config is stored per-workspace in `~/.leetcode/workspaces/<name>/config.json`.
Expand All @@ -95,6 +104,7 @@ Config is stored per-workspace in `~/.leetcode/workspaces/<name>/config.json`.
| `workDir` | Directory where solution files are saved |
| `syncRepo` | Remote Git repository URL |
| `site` | LeetCode site (`leetcode.com` or `leetcode.cn`) |
| `theme` | TUI color theme (`dark`, `light`, or `auto`) |

## Workspace-Aware Storage

Expand Down
41 changes: 41 additions & 0 deletions docs/releases.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
# Release Notes

## v3.5.0

> **Release Date**: 2026-08-14
> **Focus**: TUI Color Themes (Light/Dark/Auto) + LeetCode China Tag Null Fix + CI/CD Workflow Overhaul

### 🚀 Features

#### Color Theme Setting (`leetcode config --theme <dark|light|auto>`)

Added workspace-scoped color theme support for the Terminal UI (TUI) with dark, light, and auto modes.

- **Modes**:
- `auto` (default): Automatically detects terminal background color by querying the terminal via OSC 11, falling back to `COLORFGBG` or dark mode if the terminal does not respond within 100ms.
- `dark`: High-contrast dark theme palette tailored for dark terminals.
- `light`: Clean, readable light theme palette optimized for light terminal backgrounds.
- Configurable via CLI flag: `leetcode config --theme <dark|light|auto>`
- Configurable interactively in the TUI **Config** screen with immediate live palette hot-reloading on save.

```bash
# Pick a color theme for the TUI
leetcode config --theme light
leetcode config --theme dark
leetcode config --theme auto
```

### 🐛 Bug Fixes

#### LeetCode China Null Tag Validation ([#24](https://github.com/night-slayer18/leetcode-cli/issues/24))

- Fixed an `API Response Validation Failed` error when running `show` or `pick` against `leetcode.cn` for problems containing tags without Chinese translations.
- Updated `CnProblemDetailSchema`, `CnProblemListSchema`, and `CnDailyChallengeSchema` Zod definitions to treat `translatedName`, `nameTranslated`, and associated optional metadata as nullable.
- Gracefully falls back to the English tag `name` when Chinese translations are `null`.

### ⚙️ CI/CD & Maintenance

- **Concurrency Controls**: Added concurrency groups with `cancel-in-progress` to PR review and CI workflows to cancel redundant runs on push updates.
- **Manual CI Dispatch**: Added `workflow_dispatch` trigger to the main CI workflow.
- **Security Audit Cleanup**: Removed auto-merge logic from security audit automation workflows.

---

## v3.4.0

> **Release Date**: 2026-07-29
Expand Down
14 changes: 14 additions & 0 deletions docs/tui.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ Both screens use buffered editing:
- `Esc`: cancel current edit or go back.
- `Tab` / `h` / `l`: switch pane focus.

## Color Themes

The TUI supports dark and light themes, configured per workspace:

- **`auto`** (default): Automatically detects terminal background color by querying via OSC 11, falling back to the `COLORFGBG` environment variable or dark theme if unresponded within 100ms.
- **`dark`**: Classic dark palette with vibrant accents.
- **`light`**: High-readability light theme tailored for light terminal backgrounds.

Theme changes can be selected in the TUI **Config** screen (applies immediately on save) or via:

```bash
leetcode config --theme <dark|light|auto>
```

## Terminal Cleanup Guarantees

When leaving TUI (quit or opening external editor), the app restores terminal state:
Expand Down
52 changes: 11 additions & 41 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@night-slayer18/leetcode-cli",
"version": "3.4.0",
"version": "3.5.0",
"description": "A modern LeetCode CLI built with TypeScript",
"type": "module",
"main": "dist/index.js",
Expand Down
Loading
Loading