codewhale.history 2.8.0 → 2.8.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codewhale.history",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
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",
@@ -26,6 +26,13 @@ Optionally followed by modifiers:
26
26
  - `teach me python` — restrict to a specific language
27
27
  - `teach me level 3` / `teach me l3` — set difficulty (1–5)
28
28
  - `teach me <file or module>` — narrow scope to a specific file, directory, or module
29
+ - `teach me <concept>` — target a specific language concept. Examples:
30
+ `teach me decorators`, `teach me async`, `teach me generators`,
31
+ `teach me context managers`, `teach me comprehensions`,
32
+ `teach me error handling`, `teach me type hints`, `teach me threading`
33
+
34
+ Modifiers combine freely: `teach me decorators level 4`,
35
+ `teach me async services/`, `teach me generators l2`
29
36
 
30
37
  If no level is specified, default to **level 3** and adjust based on
31
38
  performance across rounds.
@@ -84,13 +91,32 @@ Do not repeat a snippet unless the user explicitly asks or all candidates
84
91
  are exhausted. Prefer cycling through files before returning to the same
85
92
  file.
86
93
 
94
+ #### Concept Targeting
95
+
96
+ When the user targets a specific concept, filter snippets to ensure they
97
+ contain that concept. After selecting a random candidate, verify it with
98
+ `grep_files` on the file for the concept signal. If the candidate doesn't
99
+ match, pick another random snippet (retry up to 10 times; if still no
100
+ match, relax the filter and note the fallback to the user).
101
+
102
+ | Trigger phrase | Signal to verify in the snippet |
103
+ |---|---|
104
+ | `decorators` | `@` immediately above a `def` line |
105
+ | `async` | `async def` or `await` |
106
+ | `generators` | `yield` |
107
+ | `context managers` | `with` statement or `__enter__`/`__exit__` |
108
+ | `comprehensions` | `for ... in` inside `[`, `{`, or `(` |
109
+ | `error handling` | `try:`, `except`, or `finally` |
110
+ | `type hints` | `:` type annotation in function signatures or variable assignments |
111
+ | `threading` | `Thread(`, `Lock(`, `Queue(`, or `threading.` |
112
+
87
113
  ### 3. Presentation — Show the Snippet
88
114
 
89
115
  For each round, present the snippet with its filename:
90
116
 
91
117
  ```
92
118
  ---
93
- ## Round N — Level X | `path/to/file.py` (lines A–B)
119
+ ## Round N — Level X · concept | `path/to/file.py` (lines A–B)
94
120
 
95
121
  ```python
96
122
  42 def calculate_position_size(
@@ -119,6 +145,7 @@ Guidelines:
119
145
  - Strip only excessive blank lines; keep natural spacing
120
146
  - Show the function/class signature with its decorators
121
147
  - Show the filename and line range in the header
148
+ - The `· concept` portion only appears when a concept is targeted; omit it during free-play rounds
122
149
  - If the snippet depends on one obvious external type or constant, include a
123
150
  brief inline note
124
151
  - **Before presenting, scan for secrets.** Redact API keys, tokens, passwords,
@@ -149,6 +176,20 @@ Evaluate across two dimensions, scaled to the current difficulty level.
149
176
  | 4 | Generator mechanics (`yield`), `async`/`await` internals, descriptor protocol, closures, threading primitives |
150
177
  | 5 | Coroutine internals, metaclass programming, GIL implications, memory model, `__slots__`, MRO, weak references |
151
178
 
179
+ #### Weighted Evaluation for Targeted Concepts
180
+
181
+ When a concept is targeted (e.g., `teach me decorators`), bias the
182
+ evaluation toward that concept:
183
+
184
+ - **Mechanics axis:** The targeted concept carries extra weight. Missing
185
+ it is a significant gap even if other mechanics are handled well.
186
+ - **Strike hints:** Always steer strike 1 toward the targeted concept
187
+ before hinting about any other missed item.
188
+ - **Feedback ordering:** List the targeted concept first under "What you
189
+ missed" or "What you could sharpen."
190
+ - **Success bar:** To "meet expectations," the user must correctly
191
+ explain the targeted concept at the current level's depth.
192
+
152
193
  #### The Three-Strikes Rule
153
194
 
154
195
  If the user's answer does **not** meet the expectations for the current