vibe-learning-opencode 0.2.7 → 0.2.11
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/dist/index.js +9 -68
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var recentConcepts = [];
|
|
|
11
11
|
var seniorEnabled = true;
|
|
12
12
|
var afterEnabled = true;
|
|
13
13
|
var lastSessionID = null;
|
|
14
|
-
var
|
|
14
|
+
var shownToastForSession = null;
|
|
15
15
|
var FILE_CONCEPTS = [
|
|
16
16
|
{ pattern: /test|spec|__tests__/i, concept: "unit-testing" },
|
|
17
17
|
{ pattern: /auth|login|session|jwt|oauth/i, concept: "authentication" },
|
|
@@ -106,20 +106,6 @@ After final round, call BOTH tools:
|
|
|
106
106
|
THEN say "Good thinking! Implementing now."
|
|
107
107
|
|
|
108
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.`;
|
|
123
109
|
var AUTO_LEARNING_PROMPT = `[VibeLearning - Task Completion]
|
|
124
110
|
|
|
125
111
|
Task completed. Execute these steps NOW (in order):
|
|
@@ -209,51 +195,20 @@ var VibeLearningPlugin = async (ctx) => {
|
|
|
209
195
|
});
|
|
210
196
|
};
|
|
211
197
|
return {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}).catch(() => {
|
|
218
|
-
});
|
|
219
|
-
if (event.type === "session.created") {
|
|
220
|
-
const props = event.properties;
|
|
221
|
-
const sessionID = props?.info?.id;
|
|
222
|
-
client.app.log({
|
|
223
|
-
level: "info",
|
|
224
|
-
message: `[VibeLearning] session.created - sessionID: ${sessionID}`
|
|
225
|
-
}).catch(() => {
|
|
226
|
-
});
|
|
227
|
-
if (!sessionID)
|
|
228
|
-
return;
|
|
229
|
-
lastSessionID = sessionID;
|
|
230
|
-
sessionContextShown.add(sessionID);
|
|
231
|
-
try {
|
|
198
|
+
"tool.execute.before": async (input) => {
|
|
199
|
+
if (input.tool.startsWith("mcp__vibe-learning__")) {
|
|
200
|
+
if (shownToastForSession !== input.sessionID) {
|
|
201
|
+
shownToastForSession = input.sessionID;
|
|
202
|
+
const modeInfo = seniorEnabled && afterEnabled ? "Full mode" : seniorEnabled ? "Senior mode" : afterEnabled ? "After mode" : "Off";
|
|
232
203
|
client.tui.showToast({
|
|
233
204
|
body: {
|
|
234
|
-
title: "\u{
|
|
235
|
-
message:
|
|
205
|
+
title: "\u{1F393} VibeLearning",
|
|
206
|
+
message: `Active (${modeInfo}). /learn for status.`,
|
|
236
207
|
variant: "info",
|
|
237
208
|
duration: 3e3
|
|
238
209
|
}
|
|
239
210
|
}).catch(() => {
|
|
240
211
|
});
|
|
241
|
-
const contextPrompt = `[VibeLearning - Session Start]
|
|
242
|
-
|
|
243
|
-
Execute NOW and show results to user:
|
|
244
|
-
1. Call mcp__vibe-learning__get_unknown_unknowns with period="month", limit=5
|
|
245
|
-
2. Call mcp__vibe-learning__get_due_reviews with limit=5
|
|
246
|
-
|
|
247
|
-
Format as brief notification:
|
|
248
|
-
\u{1F4DA} **[VibeLearning]**
|
|
249
|
-
\u2022 X unexplored concepts
|
|
250
|
-
\u2022 Y due for review
|
|
251
|
-
|
|
252
|
-
If nothing to show, skip silently.`;
|
|
253
|
-
injectPrompt(sessionID, contextPrompt);
|
|
254
|
-
} catch (err) {
|
|
255
|
-
client.app.log({ level: "error", message: `[VibeLearning] Session start error: ${err}` }).catch(() => {
|
|
256
|
-
});
|
|
257
212
|
}
|
|
258
213
|
}
|
|
259
214
|
},
|
|
@@ -293,21 +248,6 @@ If nothing to show, skip silently.`;
|
|
|
293
248
|
if (role !== "user" || !content)
|
|
294
249
|
return;
|
|
295
250
|
lastSessionID = input.sessionID;
|
|
296
|
-
if (!sessionContextShown.has(input.sessionID)) {
|
|
297
|
-
sessionContextShown.add(input.sessionID);
|
|
298
|
-
if (sessionContextShown.size > 10) {
|
|
299
|
-
const oldest = sessionContextShown.values().next().value;
|
|
300
|
-
if (oldest)
|
|
301
|
-
sessionContextShown.delete(oldest);
|
|
302
|
-
}
|
|
303
|
-
setTimeout(() => {
|
|
304
|
-
if (lastSessionID) {
|
|
305
|
-
injectPrompt(lastSessionID, SESSION_START_PROMPT);
|
|
306
|
-
}
|
|
307
|
-
}, 100);
|
|
308
|
-
client.app.log({ level: "info", message: `[VibeLearning] Injected session start context` }).catch(() => {
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
251
|
const cmd = parseLearnCommand(content);
|
|
312
252
|
if (cmd) {
|
|
313
253
|
if (cmd === "off") {
|
|
@@ -360,5 +300,6 @@ If nothing to show, skip silently.`;
|
|
|
360
300
|
};
|
|
361
301
|
var src_default = VibeLearningPlugin;
|
|
362
302
|
export {
|
|
303
|
+
VibeLearningPlugin,
|
|
363
304
|
src_default as default
|
|
364
305
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibe-learning-opencode",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.11",
|
|
4
4
|
"description": "VibeLearning plugin for OpenCode - spaced repetition learning while coding",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dist"
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
|
-
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --external:@opencode-ai/plugin --external:@opencode-ai/sdk",
|
|
16
|
+
"build": "esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.js --external:@opencode-ai/plugin --external:@opencode-ai/sdk --external:better-sqlite3",
|
|
17
17
|
"prepublishOnly": "npm run build"
|
|
18
18
|
},
|
|
19
19
|
"keywords": [
|
|
@@ -33,11 +33,14 @@
|
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@opencode-ai/plugin": "*",
|
|
36
|
-
"@opencode-ai/sdk": "*"
|
|
36
|
+
"@opencode-ai/sdk": "*",
|
|
37
|
+
"better-sqlite3": ">=9.0.0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@opencode-ai/plugin": "^1.1.4",
|
|
40
41
|
"@opencode-ai/sdk": "^1.0.0",
|
|
42
|
+
"@types/better-sqlite3": "^7.6.8",
|
|
43
|
+
"better-sqlite3": "^11.0.0",
|
|
41
44
|
"esbuild": "^0.20.0",
|
|
42
45
|
"typescript": "^5.0.0"
|
|
43
46
|
}
|