Skip to content

Commit a598232

Browse files
committed
feat: migrate rules/commands to .cursor and add .dev scripts
1 parent add03e2 commit a598232

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed
Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
"""Shared utilities for problem list management."""
22

3-
import json
4-
from pathlib import Path
3+
from leetcode_py.cli.utils.problem_finder import _build_problem_number_cache
54

65

76
def get_existing_problems():
87
"""Get problem numbers from existing JSON files."""
9-
# Get the project root (3 levels up from this file)
10-
project_root = Path(__file__).parent.parent.parent
11-
json_dir = project_root / "leetcode_py/cli/resources/leetcode/json/problems"
12-
existing_problems = set()
13-
14-
for json_file in json_dir.glob("*.json"):
15-
try:
16-
with open(json_file, "r") as f:
17-
data = json.load(f)
18-
problem_number = int(data.get("problem_number", 0))
19-
if problem_number > 0:
20-
existing_problems.add(problem_number)
21-
except (json.JSONDecodeError, ValueError, KeyError):
22-
continue
23-
24-
return existing_problems
8+
cache = _build_problem_number_cache()
9+
return set(cache.keys())

.cursor/commands/problem-creation.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ When user requests a problem by **number** or **name/slug**, the assistant will:
1919
8. **Verify** with `make p-lint` - fix template issues in JSON if possible, or manually fix generated files if template limitations
2020
9. **Iterate** if JSON fixes: re-run `make p-gen PROBLEM={problem_name} FORCE=1` and `make p-lint` until passes to ensure reproducibility
2121

22+
**If user does not specify a problem number or name/slug**, run:
23+
24+
```bash
25+
poetry run python .cursor/.dev/next_problem.py
26+
```
27+
28+
This will suggest the next problem to work on from the available problem lists based on completion status.
29+
2230
## Scraping Commands
2331

2432
```bash

0 commit comments

Comments
 (0)