vibe-learning-opencode 0.2.1 → 0.2.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.
Files changed (2) hide show
  1. package/dist/index.js +67 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ var recentConcepts = [];
11
11
  var seniorEnabled = true;
12
12
  var afterEnabled = true;
13
13
  var lastSessionID = null;
14
+ var sessionContextShown = /* @__PURE__ */ new Set();
14
15
  var FILE_CONCEPTS = [
15
16
  { pattern: /test|spec|__tests__/i, concept: "unit-testing" },
16
17
  { pattern: /auth|login|session|jwt|oauth/i, concept: "authentication" },
@@ -105,6 +106,20 @@ After final round, call BOTH tools:
105
106
  THEN say "Good thinking! Implementing now."
106
107
 
107
108
  ONE question per round. Be strict like a real senior.`;
109
+ var SESSION_START_PROMPT = `[VibeLearning - Session Start Context]
110
+
111
+ Execute these steps NOW to show session context:
112
+
113
+ 1. Call mcp__vibe-learning__get_unknown_unknowns with period="month" and limit=5
114
+ 2. Call mcp__vibe-learning__get_due_reviews with limit=5
115
+
116
+ Then if either has results, show a brief summary:
117
+
118
+ **[VibeLearning]** Session context:
119
+ - X unexplored concepts (use /learn unknowns)
120
+ - Y concepts due for review (use /learn review)
121
+
122
+ Keep it to 2-3 lines max. If nothing is due, don't show anything.`;
108
123
  var AUTO_LEARNING_PROMPT = `[VibeLearning - Task Completion]
109
124
 
110
125
  Task completed. Execute these steps NOW (in order):
@@ -194,6 +209,43 @@ var VibeLearningPlugin = (ctx) => {
194
209
  });
195
210
  };
196
211
  return {
212
+ // Generic event handler for session events
213
+ event: async ({ event }) => {
214
+ if (event.type === "session.created") {
215
+ const sessionID = event.properties?.id;
216
+ if (!sessionID)
217
+ return;
218
+ lastSessionID = sessionID;
219
+ sessionContextShown.add(sessionID);
220
+ try {
221
+ client.tui.showToast({
222
+ body: {
223
+ title: "\u{1F4DA} VibeLearning",
224
+ message: "Checking learning status...",
225
+ variant: "info",
226
+ duration: 2e3
227
+ }
228
+ }).catch(() => {
229
+ });
230
+ const contextPrompt = `[VibeLearning - Session Start]
231
+
232
+ Execute NOW and show results to user:
233
+ 1. Call mcp__vibe-learning__get_unknown_unknowns with period="month", limit=5
234
+ 2. Call mcp__vibe-learning__get_due_reviews with limit=5
235
+
236
+ Format as brief notification:
237
+ \u{1F4DA} **[VibeLearning]**
238
+ \u2022 X unexplored concepts
239
+ \u2022 Y due for review
240
+
241
+ If nothing to show, skip silently.`;
242
+ injectPrompt(sessionID, contextPrompt);
243
+ } catch (err) {
244
+ client.app.log({ level: "error", message: `[VibeLearning] Session start error: ${err}` }).catch(() => {
245
+ });
246
+ }
247
+ }
248
+ },
197
249
  "tool.execute.after": async (input, output) => {
198
250
  lastSessionID = input.sessionID;
199
251
  const toolLower = input.tool.toLowerCase();
@@ -230,6 +282,21 @@ var VibeLearningPlugin = (ctx) => {
230
282
  if (role !== "user" || !content)
231
283
  return;
232
284
  lastSessionID = input.sessionID;
285
+ if (!sessionContextShown.has(input.sessionID)) {
286
+ sessionContextShown.add(input.sessionID);
287
+ if (sessionContextShown.size > 10) {
288
+ const oldest = sessionContextShown.values().next().value;
289
+ if (oldest)
290
+ sessionContextShown.delete(oldest);
291
+ }
292
+ setTimeout(() => {
293
+ if (lastSessionID) {
294
+ injectPrompt(lastSessionID, SESSION_START_PROMPT);
295
+ }
296
+ }, 100);
297
+ client.app.log({ level: "info", message: `[VibeLearning] Injected session start context` }).catch(() => {
298
+ });
299
+ }
233
300
  const cmd = parseLearnCommand(content);
234
301
  if (cmd) {
235
302
  if (cmd === "off") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-learning-opencode",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "VibeLearning plugin for OpenCode - spaced repetition learning while coding",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",