oh-my-adhd 0.2.2 → 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.
- package/bin/oh-my-adhd.mjs +17 -20
- package/package.json +1 -1
package/bin/oh-my-adhd.mjs
CHANGED
|
@@ -95,31 +95,28 @@ switch (cmd) {
|
|
|
95
95
|
|
|
96
96
|
settings.hooks = settings.hooks || {};
|
|
97
97
|
|
|
98
|
-
// SessionStart:
|
|
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
|
-
|
|
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 === "
|
|
114
|
+
(h) => h.type === "command" && h.command?.includes(".session-start")
|
|
103
115
|
)
|
|
104
116
|
);
|
|
105
|
-
if (!
|
|
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
|
|
package/package.json
CHANGED