oh-my-adhd 0.2.2 → 0.2.4

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.
@@ -95,31 +95,28 @@ switch (cmd) {
95
95
 
96
96
  settings.hooks = settings.hooks || {};
97
97
 
98
- // SessionStart: wiki_recall (mcp_tool actually fires the tool, not just echo)
98
+ // SessionStart: write session-start timestamp for Stop hook
99
+ // (wiki_recall is invoked by CLAUDE.md instruction, not a hook — avoids chicken-and-egg MCP startup error)
99
100
  settings.hooks.SessionStart = settings.hooks.SessionStart || [];
100
- const alreadyHasRecall = settings.hooks.SessionStart.some((entry) =>
101
+
102
+ // Remove legacy mcp_tool wiki_recall hooks (they caused "SessionStart:startup hook error")
103
+ settings.hooks.SessionStart = settings.hooks.SessionStart.map((entry) => {
104
+ if (!Array.isArray(entry.hooks)) return entry;
105
+ const filtered = entry.hooks.filter(
106
+ (h) => !(h.type === "mcp_tool" && h.server === "oh-my-adhd" && h.tool === "wiki_recall")
107
+ );
108
+ return filtered.length === 0 ? null : { ...entry, hooks: filtered };
109
+ }).filter(Boolean);
110
+
111
+ const timestampCmd = `node -e "const{writeFileSync,mkdirSync}=require('fs'),{join}=require('path'),{homedir}=require('os');const d=process.env.OH_MY_ADHD_DIR||join(homedir(),'.oh-my-adhd');try{mkdirSync(d,{recursive:true})}catch{}writeFileSync(join(d,'.session-start'),String(Date.now()))"`;
112
+ const alreadyHasTimestamp = settings.hooks.SessionStart.some((entry) =>
101
113
  Array.isArray(entry.hooks) && entry.hooks.some(
102
- (h) => h.type === "mcp_tool" && h.server === "oh-my-adhd" && h.tool === "wiki_recall"
114
+ (h) => h.type === "command" && h.command?.includes(".session-start")
103
115
  )
104
116
  );
105
- if (!alreadyHasRecall) {
117
+ if (!alreadyHasTimestamp) {
106
118
  settings.hooks.SessionStart.push({
107
- hooks: [
108
- {
109
- type: "mcp_tool",
110
- server: "oh-my-adhd",
111
- tool: "wiki_recall",
112
- input: { limit: 5 },
113
- statusMessage: "어제 어디까지 했더라...",
114
- timeout: 15,
115
- },
116
- {
117
- type: "command",
118
- // Write session-start timestamp so Stop hook knows if a dump happened this session
119
- command: `node -e "const{writeFileSync,mkdirSync}=require('fs'),{join}=require('path'),{homedir}=require('os');const d=process.env.OH_MY_ADHD_DIR||join(homedir(),'.oh-my-adhd');try{mkdirSync(d,{recursive:true})}catch{}writeFileSync(join(d,'.session-start'),String(Date.now()))"`,
120
- timeout: 5,
121
- },
122
- ],
119
+ hooks: [{ type: "command", command: timestampCmd, timeout: 5 }],
123
120
  });
124
121
  }
125
122
 
@@ -275,7 +275,7 @@ export async function getThreads() {
275
275
  return sorted;
276
276
  }
277
277
  export async function getThread(threadId) {
278
- if (!threadId || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(threadId))
278
+ if (!threadId || !/^[a-zA-Z0-9_-]+$/.test(threadId))
279
279
  return null;
280
280
  try {
281
281
  return await fs.readFile(path.join(THREADS_DIR, `${threadId}.md`), "utf-8");
@@ -339,7 +339,7 @@ export async function savePage(slug, content) {
339
339
  await fs.writeFile(tmpPage, content, "utf-8");
340
340
  await fs.rename(tmpPage, pageFile);
341
341
  }
342
- const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
342
+ const UUID_RE = /^[a-zA-Z0-9_-]+$/;
343
343
  const TRASH_DIR = path.join(BRAIN_DIR, ".trash");
344
344
  export async function deleteThread(threadId) {
345
345
  if (!UUID_RE.test(threadId)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-adhd",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "ADHD second brain — zero-friction capture, auto context restore, unstick. MCP-native Claude Code plugin.",
5
5
  "author": "Yeachan Heo",
6
6
  "repository": {