codewhale.history 2.9.1 → 2.9.3

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
@@ -78,13 +78,22 @@ Git already has your back.
78
78
 
79
79
  ### `//teach-me`
80
80
  An interactive code-teaching quiz that randomly selects real snippets from your
81
- current project. Three modes across five difficulty levels:
81
+ current project. Two independent dimensions across five difficulty levels:
82
82
 
83
- - **Passive** (default): Explain what the code does and how it works.
84
- - **Interactive**: Lines are removed from the file — you restore the missing
85
- logic, then say `done` for the model to verify your work.
86
- - **SOLID**: Working code is rewritten with deliberate anti-patterns (breaks
87
- SOLID, DRY, cohesion). You restore good design, then say `done`.
83
+ **Response mode** (how you answer):
84
+ - **Passive** (default) Describe your answer in the console.
85
+ - **Interactive** (`teach me interactive`) Edit the actual file, say `done`.
86
+
87
+ **Content theme** (what it's about):
88
+ - **Standard** (default) — Code comprehension or line reconstruction.
89
+ - **SOLID** (`teach me solid`) — Anti-pattern detection and design restoration.
90
+
91
+ | Trigger | Response | Theme | What happens |
92
+ |---------|----------|-------|-------------|
93
+ | `teach me` | passive | standard | Present code; you explain it |
94
+ | `teach me interactive` | interactive | standard | Lines removed; you restore them |
95
+ | `teach me solid` | passive | solid | Degraded code; you describe fixes |
96
+ | `teach me solid interactive` | interactive | solid | Degraded code; you edit to fix it |
88
97
 
89
98
  **Triggers:** `teach me` · `quiz me` · `test my knowledge` · `code quiz` ·
90
99
  `drill me`
@@ -95,8 +104,8 @@ current project. Three modes across five difficulty levels:
95
104
  |----------|---------|-------------|
96
105
  | Language | `teach me python` | Restrict to Python, TypeScript, Rust, Go, Java… |
97
106
  | Level | `teach me level 3` or `teach me l3` | Set difficulty 1–5 (default: 3) |
98
- | Mode | `teach me interactive` | Reconstruction restore missing lines |
99
- | Mode | `teach me solid` | Anti-pattern detection — fix degraded design |
107
+ | Response | `teach me interactive` | Edit the file instead of describing |
108
+ | Theme | `teach me solid` | Anti-pattern detection — fix degraded design |
100
109
  | Scope | `teach me services/` | Narrow to a specific file or folder |
101
110
  | Concept | `teach me decorators` | Target: decorators, async, generators, context managers, comprehensions, error handling, type hints, threading |
102
111
 
@@ -117,19 +126,10 @@ current project. Three modes across five difficulty levels:
117
126
  **At the end** you get a session summary: rounds completed, mode, files covered,
118
127
  what you're strong on, what to review, and a suggested next level.
119
128
 
120
- ### SOLID Mode
121
-
122
- | Trigger | What happens |
123
- |---------|-------------|
124
- | `teach me solid` | SOLID mode at level 3, passive feedback |
125
- | `teach me SOLID level 4` | Level 4, passive |
126
- | `teach me solid interactive` | SOLID mode, you edit the file (not just describe) |
127
-
128
- **How it works:** The model picks code, rewrites it with deliberate anti-patterns
129
+ In **SOLID theme**: the model rewrites code with deliberate anti-patterns
129
130
  (STUPID, WET, god objects, tight coupling), presents the degraded code, and you
130
- restore good design. The model assesses across anti-patterns fixed, design
131
- quality, functional correctness, and intentionality. Files are always restored
132
- with `git checkout` after each round.
131
+ restore good design. Files are always restored with `git checkout` after each
132
+ round.
133
133
 
134
134
  ## Requirements
135
135
  - Node.js (for the `codewhale-history` command)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codewhale.history",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "description": "CodeWhale utility commands: session history, tool listing, file snapshot, interactive code quiz — global install",
5
5
  "bin": {
6
6
  "codewhale-history": "./_list_sessions.js",
@@ -6,16 +6,25 @@ description: Interactive code-teaching quiz. Selects random snippets from the cu
6
6
  # Teach Me — Interactive Code Quiz
7
7
 
8
8
  An interactive teaching session that randomly selects code snippets from the
9
- current project. Two modes:
9
+ current project. Two independent dimensions combine to form each exercise:
10
10
 
11
- - **Passive** (default): presents code, asks the user to explain it, and
12
- provides constructive feedback on **application logic** (what the code
13
- accomplishes) and **language mechanics** (syntax and semantics).
14
- - **Interactive**: removes lines from the file; the user restores them and
15
- says `done`; the model diffs against the original and gives feedback.
16
- - **SOLID**: rewrites working code to be deliberately anti-pattern-ridden
17
- (STUPID principles, WET code, poor cohesion). The user restores good
18
- design and says `done`; the model evaluates against the original.
11
+ **Response mode** (how you answer mid-session commands `passive` / `interactive`):
12
+ - **`passive`** (default) You describe your answer in the console.
13
+ - **`interactive`** You edit the actual file, then say `done` for verification.
14
+
15
+ **Content theme** (what the exercise is about trigger keyword `solid`):
16
+ - **Standard** (default) Code comprehension or line reconstruction.
17
+ - **`solid`** / **`SOLID`** Anti-pattern detection and design restoration.
18
+
19
+ | Trigger | Response | Theme | What happens |
20
+ |---------|----------|-------|-------------|
21
+ | `teach me` | passive | standard | Present code; you explain what it does and how it works |
22
+ | `teach me interactive` | interactive | standard | Lines removed from file; you restore them, say `done` |
23
+ | `teach me solid` | passive | solid | Code rewritten with anti-patterns; you describe design fixes |
24
+ | `teach me solid interactive` | interactive | solid | Code rewritten with anti-patterns; you edit the file to restore good design, say `done` |
25
+
26
+ Level, scope, language, and concept modifiers combine freely with any
27
+ combination above.
19
28
 
20
29
  ## Session Trigger
21
30
 
@@ -37,22 +46,14 @@ Optionally followed by modifiers:
37
46
  `teach me decorators`, `teach me async`, `teach me generators`,
38
47
  `teach me context managers`, `teach me comprehensions`,
39
48
  `teach me error handling`, `teach me type hints`, `teach me threading`
49
+ - `teach me interactive` — edit the file (instead of describing)
50
+ - `teach me solid` / `teach me SOLID` — anti-pattern restoration theme
40
51
 
41
52
  Modifiers combine freely: `teach me decorators level 4`,
42
53
  `teach me async services/`, `teach me generators l2`,
43
54
  `teach me level 2 interactive`, `teach me interactive decorators`,
44
- `teach me solid level 3`, `teach me SOLID`
45
-
46
- Three modes are available, orthogonal to difficulty:
47
-
48
- - **`passive`** (default) — You explain what the code does and how it works.
49
- - **`interactive`** — Lines are removed from the file; you restore the missing
50
- logic. When done, say `done` or `check my work` and the model verifies.
51
- - **`solid`** / **`SOLID`** — Working code is rewritten with deliberate
52
- anti-patterns (breaks SOLID, DRY, cohesion, abstraction). You restore good
53
- design principles. When done, say `done` or `check my work`.
54
-
55
- Switch modes mid-session with `passive`, `interactive`, or `solid`.
55
+ `teach me solid level 3`, `teach me SOLID`,
56
+ `teach me solid interactive`
56
57
 
57
58
  If no level is specified, default to **level 3** and adjust based on
58
59
  performance across rounds.
@@ -132,10 +133,11 @@ match, relax the filter and note the fallback to the user).
132
133
  | `type hints` | `:` type annotation in function signatures or variable assignments |
133
134
  | `threading` | `Thread(`, `Lock(`, `Queue(`, or `threading.` |
134
135
 
135
- ### 2b. Interactive Mode — Reconstruction
136
+ ### 2b. Interactive (Standard)Line Reconstruction
136
137
 
137
- When mode is `interactive`, each round follows a different flow from passive
138
- explanation. The model removes lines from the file and the user restores them.
138
+ When response mode is `interactive` (and theme is standard), each round follows
139
+ a different flow from passive explanation. The model removes lines from the
140
+ file and the user restores them.
139
141
 
140
142
  #### Lines Removed by Level
141
143
 
@@ -211,13 +213,19 @@ Type `hint` for a clue, `skip` to see the answer, or `stop` to end.
211
213
  ---
212
214
  ```
213
215
 
214
- ### 2c. SOLID Mode — Anti-Pattern Reconstruction
216
+ ### 2c. SOLID Theme — Anti-Pattern Reconstruction
215
217
 
216
- When mode is `solid` (or `SOLID`), the model rewrites working code to be
217
- deliberately anti-pattern-ridden — breaking SOLID principles, DRY, cohesion,
218
+ When content theme is `solid` (or `SOLID`), the model rewrites working code to
219
+ be deliberately anti-pattern-ridden — breaking SOLID principles, DRY, cohesion,
218
220
  and abstraction — while keeping the code functional. The user must restore
219
221
  good design.
220
222
 
223
+ SOLID theme works with both response modes:
224
+ - **passive + solid** (`teach me solid`): User describes design fixes in console.
225
+ - **interactive + solid** (`teach me solid interactive`): User edits the file.
226
+
227
+ The per-round flow below covers both; where they differ, both variants are noted.
228
+
221
229
  #### Scope by Level
222
230
 
223
231
  | Level | Scope | Anti-patterns introduced |
@@ -250,7 +258,7 @@ anti-patterns appropriate to the language and scope:
250
258
  - God object — one class/method that knows and does everything
251
259
  - Shotgun surgery — one change requires touching many files/methods
252
260
 
253
- #### SOLID Mode Per-Round Flow
261
+ #### SOLID Theme Per-Round Flow
254
262
 
255
263
  0. **Snapshot git state.** Run `git status --porcelain <file>` before touching it.
256
264
  1. **Select** a snippet using the standard rules (section 2). For levels 3–5,
@@ -262,14 +270,20 @@ anti-patterns appropriate to the language and scope:
262
270
  4. **Present** the deconstructed code. State the scope, the number of
263
271
  anti-patterns introduced, but do NOT name or annotate them — the user must
264
272
  find them.
265
- 5. **Instruct:** "Open `<file>`, find and fix the [N] anti-patterns. The code
266
- should still work. Say `done` or `check my work` when ready."
267
- 6. **Wait.** Do not evaluate until the user signals completion.
268
- 7. **Re-read** the file. Compare against the saved original.
269
- 8. **Feedback** (see SOLID Evaluation below). Restore with `git checkout -- <file>`.
270
- 9. **Restore.** After feedback, `git checkout -- <file>` for a byte-perfect reset.
271
- If pre-existing uncommitted changes (step 0), warn the user and offer manual
272
- restore.
273
+ 5. **Instruct** (depends on response mode):
274
+ - *Interactive:* "Open `<file>`, fix the [N] anti-patterns. Say `done`."
275
+ - *Passive:* "Describe how you'd improve this code what anti-patterns do
276
+ you see, and how would you fix them?"
277
+ 6. **Wait.** Do not evaluate until the user signals completion (`done` or answer).
278
+ 7. **Evaluate** (depends on response mode):
279
+ - *Interactive:* Re-read the file. Compare against saved original.
280
+ - *Passive:* Evaluate the user's description against the anti-patterns
281
+ that were introduced. No file re-read needed.
282
+ 8. **Feedback** (see SOLID Evaluation below).
283
+ 9. **Restore.** After feedback, `git checkout -- <file>` for a byte-perfect
284
+ reset. If pre-existing uncommitted changes (step 0), warn the user. For
285
+ passive mode, no file was modified by the user, but the deconstructed
286
+ code the model wrote must still be restored.
273
287
 
274
288
  #### Thinking Suppression (SOLID Mode)
275
289
 
@@ -281,7 +295,7 @@ original code or the specific anti-patterns chosen in your reasoning.
281
295
 
282
296
  ```
283
297
  ---
284
- ## Round N — Level X · solid | `path/to/file.py` (lines A–B)
298
+ ## Round N — Level X · passive · solid | `path/to/file.py` (lines A–B)
285
299
 
286
300
  ```python
287
301
  42 class ReportGenerator:
@@ -320,7 +334,7 @@ For each round, present the snippet with its filename:
320
334
 
321
335
  ```
322
336
  ---
323
- ## Round N — Level X · [interactive|passive] · concept | `path/to/file.py` (lines A–B)
337
+ ## Round N — Level X · [passive|interactive] · [concept|solid] | `path/to/file.py` (lines A–B)
324
338
 
325
339
  ```python
326
340
  42 def calculate_position_size(
@@ -349,8 +363,8 @@ Guidelines:
349
363
  - Strip only excessive blank lines; keep natural spacing
350
364
  - Show the function/class signature with its decorators
351
365
  - Show the filename and line range in the header
352
- - The mode tag (`· interactive` or `· passive`) always appears in the header
353
- - The `· concept` portion only appears when a concept is targeted; omit it during free-play rounds
366
+ - The response mode tag (`· passive` or `· interactive`) always appears in the header
367
+ - The theme/concept tag (solid` for SOLID theme, or decorators` etc. for targeted concept) appears when applicable; omit during free-play standard rounds
354
368
  - If the snippet depends on one obvious external type or constant, include a
355
369
  brief inline note
356
370
  - **Before presenting, scan for secrets.** Redact API keys, tokens, passwords,