oh-my-adhd 0.2.7 → 0.2.8
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/mcp/lib/brain.js
CHANGED
|
@@ -202,8 +202,8 @@ export async function saveCapture(content, threadId) {
|
|
|
202
202
|
const idx = manifest.findIndex((m) => m.id === tid);
|
|
203
203
|
// Compute signal cache fields from new content
|
|
204
204
|
const stripped = stripGitSuffix(content).trim();
|
|
205
|
-
const is_open = OPEN_SIGNAL.test(stripped);
|
|
206
|
-
const is_done = DONE_SIGNAL.test(stripped)
|
|
205
|
+
const is_open = OPEN_SIGNAL.test(stripped) && !DONE_SIGNAL.test(stripped);
|
|
206
|
+
const is_done = DONE_SIGNAL.test(stripped);
|
|
207
207
|
const last_action = stripped.replace(/\n+/g, " ").slice(0, 160);
|
|
208
208
|
const next_action = extractFieldBrain(stripped, "다음할것").slice(0, 120);
|
|
209
209
|
const blocker = extractFieldBrain(stripped, "막힌것").slice(0, 120);
|
|
@@ -217,6 +217,8 @@ export async function saveCapture(content, threadId) {
|
|
|
217
217
|
else
|
|
218
218
|
manifest.push(meta);
|
|
219
219
|
await writeManifest(manifest.sort((a, b) => new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime()));
|
|
220
|
+
// Session-scoped dump marker for stop-hook
|
|
221
|
+
await fs.writeFile(path.join(BRAIN_DIR, ".last-dump"), String(Date.now()), "utf-8").catch(() => { });
|
|
220
222
|
});
|
|
221
223
|
return { capture, threadId: tid, title, skipped };
|
|
222
224
|
}
|
|
@@ -240,7 +242,7 @@ export async function getThreads() {
|
|
|
240
242
|
const scanCaptures = content.split(/\n---\n/).slice(1).filter((p) => p.trim());
|
|
241
243
|
const lastCapture = scanCaptures.at(-1) ?? "";
|
|
242
244
|
const fullText = lastCapture.replace(/^(?:_[^_\n]+_|\*\*[^*\n]+\*\*)\s*/m, "").trim();
|
|
243
|
-
const is_open = OPEN_SIGNAL.test(fullText);
|
|
245
|
+
const is_open = OPEN_SIGNAL.test(fullText) && !DONE_SIGNAL.test(fullText);
|
|
244
246
|
return {
|
|
245
247
|
id: tid,
|
|
246
248
|
title,
|
|
@@ -251,7 +253,7 @@ export async function getThreads() {
|
|
|
251
253
|
next_action: extractFieldBrain(fullText, "다음할것").slice(0, 120),
|
|
252
254
|
blocker: extractFieldBrain(fullText, "막힌것").slice(0, 120),
|
|
253
255
|
capture_count: scanCaptures.length,
|
|
254
|
-
is_done: DONE_SIGNAL.test(fullText)
|
|
256
|
+
is_done: DONE_SIGNAL.test(fullText),
|
|
255
257
|
};
|
|
256
258
|
}));
|
|
257
259
|
results
|
|
@@ -63,6 +63,13 @@ export function registerWikiDump(server) {
|
|
|
63
63
|
}
|
|
64
64
|
catch { /* dead-end check is best-effort, never crash */ }
|
|
65
65
|
}
|
|
66
|
+
// Dopamine streak: show today's save count when ≥2
|
|
67
|
+
if (!result.skipped && allThreads.length > 0) {
|
|
68
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
69
|
+
const todayCount = allThreads.filter(t => t.updatedAt?.startsWith(today)).length;
|
|
70
|
+
if (todayCount >= 2)
|
|
71
|
+
respLines[0] = `저장됨 ✓ (오늘 ${todayCount}번째 🔥)`;
|
|
72
|
+
}
|
|
66
73
|
// Only nag if user has NEVER successfully used structured schema — avoids repeated noise
|
|
67
74
|
const hasEverStructured = allThreads.some(t => t.id === result.threadId && (t.next_action || t.blocker));
|
|
68
75
|
if (!isStructured && !result.skipped && !hasEverStructured) {
|
|
@@ -38,7 +38,7 @@ export function registerWikiRecall(server) {
|
|
|
38
38
|
// Use stored next_action/blocker from manifest if available
|
|
39
39
|
next_action = t.next_action ?? "";
|
|
40
40
|
blocker = t.blocker ?? "";
|
|
41
|
-
const is_done = t.is_done !== undefined ? t.is_done :
|
|
41
|
+
const is_done = t.is_done !== undefined ? t.is_done : DONE_SIGNAL.test(last_action);
|
|
42
42
|
const gapHours = isNaN(new Date(t.updatedAt).getTime())
|
|
43
43
|
? null
|
|
44
44
|
: Math.max(0, Math.round((Date.now() - new Date(t.updatedAt).getTime()) / 3600000));
|
|
@@ -63,8 +63,8 @@ export function registerWikiRecall(server) {
|
|
|
63
63
|
const captures = content.split(/\n---\n/).slice(1).filter((p) => p.trim());
|
|
64
64
|
const lastCapture = captures.at(-1) ?? "";
|
|
65
65
|
const fullText = lastCapture.replace(/^(?:_[^_\n]+_|\*\*[^*\n]+\*\*)\s*/m, "").trim();
|
|
66
|
-
is_open = OPEN_SIGNAL.test(fullText);
|
|
67
|
-
const isDone = DONE_SIGNAL.test(fullText)
|
|
66
|
+
is_open = OPEN_SIGNAL.test(fullText) && !DONE_SIGNAL.test(fullText);
|
|
67
|
+
const isDone = DONE_SIGNAL.test(fullText);
|
|
68
68
|
last_action = fullText.replace(/\n+/g, " ").slice(0, 160);
|
|
69
69
|
next_action = extractFieldBrain(fullText, "다음할것").slice(0, 120);
|
|
70
70
|
blocker = extractFieldBrain(fullText, "막힌것").slice(0, 120);
|
package/package.json
CHANGED
package/scripts/stop-hook.mjs
CHANGED
|
@@ -7,11 +7,18 @@ import { homedir } from "os";
|
|
|
7
7
|
const BRAIN_DIR = process.env.OH_MY_ADHD_DIR ?? join(homedir(), ".oh-my-adhd");
|
|
8
8
|
const MANIFEST = join(BRAIN_DIR, "threads", ".manifest.json");
|
|
9
9
|
const SESSION_START_FILE = join(BRAIN_DIR, ".session-start");
|
|
10
|
+
const LAST_DUMP_FILE = join(BRAIN_DIR, ".last-dump");
|
|
10
11
|
|
|
11
12
|
try {
|
|
12
13
|
const sessionStartMs = parseInt(readFileSync(SESSION_START_FILE, "utf-8").trim(), 10);
|
|
13
14
|
if (isNaN(sessionStartMs)) process.exit(0); // no marker — don't block
|
|
14
15
|
|
|
16
|
+
// Session-scoped check: did wiki_dump run after this session started?
|
|
17
|
+
try {
|
|
18
|
+
const lastDumpMs = parseInt(readFileSync(LAST_DUMP_FILE, "utf-8").trim(), 10);
|
|
19
|
+
if (!isNaN(lastDumpMs) && lastDumpMs > sessionStartMs) process.exit(0);
|
|
20
|
+
} catch { /* .last-dump missing = no dump this session */ }
|
|
21
|
+
|
|
15
22
|
let manifest;
|
|
16
23
|
try {
|
|
17
24
|
manifest = JSON.parse(readFileSync(MANIFEST, "utf-8"));
|
|
@@ -19,13 +26,6 @@ try {
|
|
|
19
26
|
process.exit(0); // no manifest — nothing to protect
|
|
20
27
|
}
|
|
21
28
|
|
|
22
|
-
// Allow stop if any dump happened after session start
|
|
23
|
-
const latestDump = manifest.reduce((max, t) => {
|
|
24
|
-
const ts = new Date(t.updatedAt).getTime();
|
|
25
|
-
return ts > max ? ts : max;
|
|
26
|
-
}, 0);
|
|
27
|
-
if (latestDump > sessionStartMs) process.exit(0);
|
|
28
|
-
|
|
29
29
|
// Block only if there are open threads worth saving
|
|
30
30
|
const openThreads = manifest.filter(t => t.is_open);
|
|
31
31
|
if (openThreads.length > 0) {
|