lc-review 0.0.6 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,13 +25,32 @@ Example:
25
25
  lc-review next 3
26
26
  ```
27
27
 
28
- Record a solved attempt (grade 1-5):
28
+ Record a solved attempt (confidence range: 0.0 to 1.0):
29
29
 
30
- - `lc-review add <problem_number> <grade>`
30
+ - `lc-review add <problem_number> <confidence>`
31
31
 
32
32
  Example:
33
33
 
34
34
  ```bash
35
35
  # add a problem result
36
- lc-review add 1234 4
36
+ lc-review add 1234 0.4
37
37
  ```
38
+
39
+ ## solutions.log File
40
+
41
+ The tool automatically creates and maintains a `solutions.log` file in your
42
+ current directory to track your problem-solving history. Each entry is recorded
43
+ in the following format:
44
+
45
+ ```
46
+ date=YYYY-MM-DD problem=#### confidence=N.N [skip=true]
47
+ ```
48
+
49
+ - **date**: The date you solved the problem (ISO format)
50
+ - **problem**: The LeetCode problem number (zero-padded to 4 digits)
51
+ - **confidence**: Your confidence level from 0.0 (no confidence) to 1.0 (full
52
+ confidence)
53
+ - **skip**: Optional flag to mark a problem as skipped in reviews
54
+
55
+ This file is used by the SM2 algorithm to calculate when you should review each
56
+ problem next.
package/dist/index.mjs CHANGED
@@ -3,6 +3,7 @@ import { appendFile, readFile } from "node:fs/promises";
3
3
  import process from "node:process";
4
4
  import { z } from "zod";
5
5
  import { supermemo } from "supermemo";
6
+ import { log } from "node:console";
6
7
 
7
8
  //#region src/core.ts
8
9
  const logRecordSchema = z.object({
@@ -100883,6 +100884,7 @@ const ProblemSetSchema = z.object({ data: z.object({ problemsetQuestionListV2: z
100883
100884
  //#endregion
100884
100885
  //#region src/data.ts
100885
100886
  const parsedProblemSet = ProblemSetSchema.parse(problems_default);
100887
+ const ALL_PROBLEMS = parsedProblemSet.data.problemsetQuestionListV2.questions;
100886
100888
  const PREMIUM_PROBLEMS = new Set(parsedProblemSet.data.problemsetQuestionListV2.questions.filter((q) => q.paidOnly).map((q) => q.id));
100887
100889
 
100888
100890
  //#endregion
@@ -100964,7 +100966,7 @@ const review = async (logFile, n, premium = false) => {
100964
100966
 
100965
100967
  //#endregion
100966
100968
  //#region package.json
100967
- var version = "0.0.6";
100969
+ var version = "0.0.9";
100968
100970
 
100969
100971
  //#endregion
100970
100972
  //#region src/index.ts
@@ -101016,8 +101018,13 @@ async function main() {
101016
101018
  case "debug:show-json-log": {
101017
101019
  const logFile = args.shift();
101018
101020
  if (!logFile) throw new Error("no log file provided");
101019
- const records = await readLogFromFile(logFile);
101020
- console.log(JSON.stringify(records, null, 2));
101021
+ await showJsonLog(logFile);
101022
+ break;
101023
+ }
101024
+ case "debug:show-problem-info": {
101025
+ const problemNumber = args.shift();
101026
+ if (!problemNumber) throw new Error("no problem number provided");
101027
+ showProblemInfo(problemNumber);
101021
101028
  break;
101022
101029
  }
101023
101030
  default:
@@ -101054,8 +101061,29 @@ Commands:
101054
101061
  Debug commands:
101055
101062
 
101056
101063
  debug:show-json-log <log_file>
101064
+
101065
+ debug:show-problem-info <problem_number>
101057
101066
  `);
101058
101067
  }
101068
+ async function showProblemInfo(problemNumber) {
101069
+ const problem = ALL_PROBLEMS.find((p) => p.id === parseInt(problemNumber));
101070
+ if (!problem) {
101071
+ console.log(`Problem ${problemNumber} not found.`);
101072
+ return;
101073
+ }
101074
+ log(`ID: ${problem.id}`);
101075
+ log(`Title: ${problem.title}`);
101076
+ log(`Difficulty: ${problem.difficulty}`);
101077
+ log(`Paid only: ${problem.paidOnly}`);
101078
+ log(`AC Rate: ${(problem.acRate * 100).toFixed(2)}%`);
101079
+ if (problem.topicTags) log(`Topics: ${problem.topicTags.map((tag) => tag.name).join(", ")}`);
101080
+ log(`URL: https://leetcode.com/problems/${problem.titleSlug}/`);
101081
+ log(`AC rate: ${(problem.acRate * 100).toFixed(2)}%`);
101082
+ }
101083
+ async function showJsonLog(logFile) {
101084
+ const records = await readLogFromFile(logFile);
101085
+ console.log(JSON.stringify(records, null, 2));
101086
+ }
101059
101087
 
101060
101088
  //#endregion
101061
101089
  export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lc-review",
3
- "version": "0.0.6",
3
+ "version": "0.0.9",
4
4
  "description": "LeetCode flashcards for spaced repetition learning",
5
5
  "repository": {
6
6
  "type": "git",