vibe-learning-opencode 0.2.10 → 0.2.12

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 +11 -109
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,63 +1,4 @@
1
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
- }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
6
- throw Error('Dynamic require of "' + x + '" is not supported');
7
- });
8
-
9
1
  // src/index.ts
10
- import * as path from "node:path";
11
- import * as os from "node:os";
12
- import * as fs from "node:fs";
13
- var DB_DIR = ".vibe-learning";
14
- var DB_FILENAME = "learning.db";
15
- function getLearningStatus() {
16
- try {
17
- const dbPath = path.join(os.homedir(), DB_DIR, DB_FILENAME);
18
- if (!fs.existsSync(dbPath)) {
19
- return {
20
- unknownUnknowns: { count: 0 },
21
- dueReviews: { count: 0 }
22
- };
23
- }
24
- const Database = __require("better-sqlite3");
25
- const db = new Database(dbPath, { readonly: true });
26
- try {
27
- const unknownsCount = db.prepare(
28
- "SELECT COUNT(*) as count FROM unknown_unknowns WHERE explored = 0"
29
- ).get();
30
- const firstUnknown = db.prepare(
31
- "SELECT concept_id FROM unknown_unknowns WHERE explored = 0 ORDER BY appearances DESC, first_seen DESC LIMIT 1"
32
- ).get();
33
- const today = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34
- const reviewsCount = db.prepare(
35
- "SELECT COUNT(*) as count FROM concept_progress WHERE next_review IS NOT NULL AND next_review <= ?"
36
- ).get(today);
37
- const firstReview = db.prepare(
38
- "SELECT concept_id FROM concept_progress WHERE next_review IS NOT NULL AND next_review <= ? ORDER BY next_review ASC LIMIT 1"
39
- ).get(today);
40
- return {
41
- unknownUnknowns: {
42
- count: unknownsCount?.count ?? 0,
43
- first: firstUnknown?.concept_id
44
- },
45
- dueReviews: {
46
- count: reviewsCount?.count ?? 0,
47
- first: firstReview?.concept_id
48
- }
49
- };
50
- } finally {
51
- db.close();
52
- }
53
- } catch (error) {
54
- return {
55
- unknownUnknowns: { count: 0 },
56
- dueReviews: { count: 0 },
57
- error: error instanceof Error ? error.message : "Unknown error"
58
- };
59
- }
60
- }
61
2
  var CONFIG = {
62
3
  TOOL_THRESHOLD: 3,
63
4
  COOLDOWN_MS: 15 * 60 * 1e3,
@@ -239,7 +180,7 @@ var VibeLearningPlugin = async (ctx) => {
239
180
  const { client } = ctx;
240
181
  client.app.log({
241
182
  level: "info",
242
- message: "[VibeLearning] Plugin loaded (v3 - session toast)"
183
+ message: "[VibeLearning] Plugin loaded (v2 - independent toggles)"
243
184
  }).catch(() => {
244
185
  });
245
186
  const injectPrompt = (sessionID, prompt) => {
@@ -253,60 +194,17 @@ var VibeLearningPlugin = async (ctx) => {
253
194
  });
254
195
  };
255
196
  return {
256
- // Session created - show toast with learning status
257
197
  "session.created": async (input) => {
258
- lastSessionID = input.id;
259
- const status = getLearningStatus();
260
- let message;
261
- let variant = "info";
262
- if (status.error) {
263
- message = "Learning mode active. Use /learn to check status.";
264
- } else if (status.unknownUnknowns.count === 0 && status.dueReviews.count === 0) {
265
- message = "All caught up! No pending reviews.";
266
- variant = "success";
267
- } else {
268
- const parts = [];
269
- if (status.unknownUnknowns.count > 0) {
270
- const { first, count } = status.unknownUnknowns;
271
- if (first) {
272
- if (count === 1) {
273
- parts.push(`New concept: "${first}"`);
274
- } else {
275
- parts.push(`New concepts: "${first}" +${count - 1} more`);
276
- }
277
- } else {
278
- parts.push(`${count} new concepts to learn`);
279
- }
280
- }
281
- if (status.dueReviews.count > 0) {
282
- const { first, count } = status.dueReviews;
283
- if (first) {
284
- if (count === 1) {
285
- parts.push(`Due for review: "${first}"`);
286
- } else {
287
- parts.push(`Due for review: "${first}" +${count - 1} more`);
288
- }
289
- } else {
290
- parts.push(`${count} concepts due for review`);
291
- }
292
- }
293
- message = parts.join(" | ");
294
- variant = "warning";
295
- }
198
+ const modeInfo = seniorEnabled && afterEnabled ? "Full mode" : seniorEnabled ? "Senior mode" : afterEnabled ? "After mode" : "Off";
296
199
  client.tui.showToast({
297
200
  body: {
298
- title: "\u{1F4DA} VibeLearning",
299
- message,
300
- variant,
301
- duration: 5e3
201
+ title: "\u{1F393} VibeLearning",
202
+ message: `Active (${modeInfo}). /learn for status.`,
203
+ variant: "info",
204
+ duration: 3e3
302
205
  }
303
206
  }).catch(() => {
304
207
  });
305
- client.app.log({
306
- level: "info",
307
- message: `[VibeLearning] Session created: ${input.id} (unknowns: ${status.unknownUnknowns.count}, reviews: ${status.dueReviews.count})`
308
- }).catch(() => {
309
- });
310
208
  },
311
209
  "tool.execute.after": async (input, output) => {
312
210
  lastSessionID = input.sessionID;
@@ -365,11 +263,15 @@ var VibeLearningPlugin = async (ctx) => {
365
263
  }
366
264
  const prompt = COMMAND_PROMPTS[cmd];
367
265
  if (prompt) {
266
+ client.tui.showToast({
267
+ body: { title: "\u{1F393} VibeLearning", message: `Executing /learn ${cmd}...`, variant: "info", duration: 2e3 }
268
+ }).catch(() => {
269
+ });
368
270
  setTimeout(() => {
369
271
  if (lastSessionID) {
370
272
  injectPrompt(lastSessionID, prompt);
371
273
  }
372
- }, 100);
274
+ }, 500);
373
275
  }
374
276
  client.app.log({ level: "info", message: `[VibeLearning] Command: ${cmd}` }).catch(() => {
375
277
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-learning-opencode",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "VibeLearning plugin for OpenCode - spaced repetition learning while coding",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",