keepmind 1.0.0
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/.agents/plugins/marketplace.json +20 -0
- package/.codex-plugin/plugin.json +46 -0
- package/LICENSE +202 -0
- package/README.md +139 -0
- package/dist/npx-cli/index.js +1398 -0
- package/dist/opencode-plugin/index.js +68 -0
- package/openclaw/Dockerfile.e2e +46 -0
- package/openclaw/SKILL.md +462 -0
- package/openclaw/TESTING.md +279 -0
- package/openclaw/dist/index.js +20 -0
- package/openclaw/e2e-verify.sh +222 -0
- package/openclaw/install.sh +1653 -0
- package/openclaw/openclaw.plugin.json +98 -0
- package/openclaw/package.json +21 -0
- package/openclaw/skills/do/SKILL.md +1 -0
- package/openclaw/skills/make-plan/SKILL.md +1 -0
- package/openclaw/src/index.test.ts +1178 -0
- package/openclaw/src/index.ts +1136 -0
- package/openclaw/test-e2e.sh +40 -0
- package/openclaw/test-install.sh +2086 -0
- package/openclaw/test-sse-consumer.js +98 -0
- package/openclaw/tsconfig.json +26 -0
- package/package.json +187 -0
- package/plugin/.claude-plugin/plugin.json +24 -0
- package/plugin/.codex-plugin/plugin.json +46 -0
- package/plugin/.mcp.json +12 -0
- package/plugin/bun.lock +325 -0
- package/plugin/hooks/bugfixes-2026-01-10.md +92 -0
- package/plugin/hooks/codex-hooks.json +63 -0
- package/plugin/hooks/hooks.json +117 -0
- package/plugin/modes/code--ar.json +24 -0
- package/plugin/modes/code--bn.json +24 -0
- package/plugin/modes/code--chill.json +8 -0
- package/plugin/modes/code--cs.json +24 -0
- package/plugin/modes/code--da.json +24 -0
- package/plugin/modes/code--de.json +24 -0
- package/plugin/modes/code--el.json +24 -0
- package/plugin/modes/code--es.json +24 -0
- package/plugin/modes/code--fi.json +24 -0
- package/plugin/modes/code--fr.json +24 -0
- package/plugin/modes/code--he.json +24 -0
- package/plugin/modes/code--hi.json +24 -0
- package/plugin/modes/code--hu.json +24 -0
- package/plugin/modes/code--id.json +24 -0
- package/plugin/modes/code--it.json +24 -0
- package/plugin/modes/code--ja.json +24 -0
- package/plugin/modes/code--ko.json +24 -0
- package/plugin/modes/code--nl.json +24 -0
- package/plugin/modes/code--no.json +24 -0
- package/plugin/modes/code--pl.json +24 -0
- package/plugin/modes/code--pt-br.json +24 -0
- package/plugin/modes/code--ro.json +24 -0
- package/plugin/modes/code--ru.json +24 -0
- package/plugin/modes/code--sv.json +24 -0
- package/plugin/modes/code--th.json +24 -0
- package/plugin/modes/code--tr.json +24 -0
- package/plugin/modes/code--uk.json +24 -0
- package/plugin/modes/code--ur.json +25 -0
- package/plugin/modes/code--vi.json +24 -0
- package/plugin/modes/code--zh.json +24 -0
- package/plugin/modes/code.json +139 -0
- package/plugin/modes/email-investigation.json +120 -0
- package/plugin/modes/law-study--chill.json +7 -0
- package/plugin/modes/law-study-CLAUDE.md +85 -0
- package/plugin/modes/law-study.json +120 -0
- package/plugin/modes/meme-tokens.json +125 -0
- package/plugin/package.json +47 -0
- package/plugin/scripts/bun-runner.js +229 -0
- package/plugin/scripts/context-generator.cjs +1005 -0
- package/plugin/scripts/mcp-server.cjs +247 -0
- package/plugin/scripts/statusline-counts.js +45 -0
- package/plugin/scripts/transcript-watcher.cjs +27 -0
- package/plugin/scripts/version-check.js +193 -0
- package/plugin/scripts/worker-cli.js +19 -0
- package/plugin/scripts/worker-service.cjs +2638 -0
- package/plugin/scripts/worker-wrapper.cjs +2 -0
- package/plugin/skills/babysit/SKILL.md +87 -0
- package/plugin/skills/design-is/SKILL.md +312 -0
- package/plugin/skills/do/SKILL.md +45 -0
- package/plugin/skills/how-it-works/SKILL.md +22 -0
- package/plugin/skills/how-it-works/onboarding-explainer.md +17 -0
- package/plugin/skills/knowledge-agent/SKILL.md +80 -0
- package/plugin/skills/learn-codebase/SKILL.md +21 -0
- package/plugin/skills/make-plan/SKILL.md +67 -0
- package/plugin/skills/mem-search/SKILL.md +131 -0
- package/plugin/skills/oh-my-issues/SKILL.md +226 -0
- package/plugin/skills/pathfinder/SKILL.md +111 -0
- package/plugin/skills/smart-explore/SKILL.md +193 -0
- package/plugin/skills/standup/SKILL.md +142 -0
- package/plugin/skills/standup/agent-brief.md +47 -0
- package/plugin/skills/standup/standup.mjs +662 -0
- package/plugin/skills/timeline-report/SKILL.md +211 -0
- package/plugin/skills/version-bump/SKILL.md +74 -0
- package/plugin/skills/version-bump/scripts/generate_changelog.js +34 -0
- package/plugin/skills/weekly-digests/SKILL.md +262 -0
- package/plugin/skills/what-the/SKILL.md +6 -0
- package/plugin/skills/wowerpoint/SKILL.md +205 -0
- package/plugin/ui/assets/fonts/monaspace-radon-var.woff +0 -0
- package/plugin/ui/assets/fonts/monaspace-radon-var.woff2 +0 -0
- package/plugin/ui/icon-thick-completed.svg +8 -0
- package/plugin/ui/icon-thick-investigated.svg +8 -0
- package/plugin/ui/icon-thick-learned.svg +12 -0
- package/plugin/ui/icon-thick-next-steps.svg +8 -0
- package/plugin/ui/viewer-bundle.js +65 -0
- package/plugin/ui/viewer.html +3302 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync, spawn } from 'child_process';
|
|
3
|
+
import { existsSync, readFileSync, mkdirSync, appendFileSync, writeFileSync } from 'fs';
|
|
4
|
+
import { join, dirname, resolve } from 'path';
|
|
5
|
+
import { homedir } from 'os';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
|
|
8
|
+
const IS_WINDOWS = process.platform === 'win32';
|
|
9
|
+
|
|
10
|
+
const __bun_runner_dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
|
+
const RESOLVED_PLUGIN_ROOT = process.env.CLAUDE_PLUGIN_ROOT || resolve(__bun_runner_dirname, '..');
|
|
12
|
+
|
|
13
|
+
function fixBrokenScriptPath(argPath) {
|
|
14
|
+
if (argPath.startsWith('/scripts/') && !existsSync(argPath)) {
|
|
15
|
+
const fixedPath = join(RESOLVED_PLUGIN_ROOT, argPath);
|
|
16
|
+
if (existsSync(fixedPath)) {
|
|
17
|
+
return fixedPath;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return argPath;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function findNode() {
|
|
24
|
+
// This launcher is itself invoked via `node bun-runner.js ...` (see
|
|
25
|
+
// plugin/hooks/hooks.json), so process.execPath is the exact Node binary the
|
|
26
|
+
// host uses. Re-use it to run the worker bundle — the worker now runs under
|
|
27
|
+
// Node (node:sqlite), not Bun.
|
|
28
|
+
if (process.execPath && existsSync(process.execPath)) {
|
|
29
|
+
return process.execPath;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const pathCheck = IS_WINDOWS
|
|
33
|
+
? spawnSync('where node', {
|
|
34
|
+
encoding: 'utf-8',
|
|
35
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
36
|
+
shell: true
|
|
37
|
+
})
|
|
38
|
+
: spawnSync('which', ['node'], {
|
|
39
|
+
encoding: 'utf-8',
|
|
40
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
if (pathCheck.status === 0 && pathCheck.stdout.trim()) {
|
|
44
|
+
const firstLine = pathCheck.stdout.split('\n').map(line => line.trim()).find(line => line.length > 0);
|
|
45
|
+
if (firstLine) {
|
|
46
|
+
return firstLine;
|
|
47
|
+
}
|
|
48
|
+
return 'node';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function isPluginDisabledInClaudeSettings() {
|
|
55
|
+
try {
|
|
56
|
+
const configDir = process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude');
|
|
57
|
+
const settingsPath = join(configDir, 'settings.json');
|
|
58
|
+
if (!existsSync(settingsPath)) return false;
|
|
59
|
+
const settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
60
|
+
// No optional chaining (?.) here: this launcher must parse on the oldest
|
|
61
|
+
// Node that any host might invoke it with. Some Claude Code installs run
|
|
62
|
+
// hooks under a bundled pre-ES2020 Node whose ESM loader throws
|
|
63
|
+
// "SyntaxError: Unexpected token '.'" on `?.` (issue #2791).
|
|
64
|
+
return Boolean(
|
|
65
|
+
settings &&
|
|
66
|
+
settings.enabledPlugins &&
|
|
67
|
+
settings.enabledPlugins['keepmind@keepmind'] === false
|
|
68
|
+
);
|
|
69
|
+
} catch {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (isPluginDisabledInClaudeSettings()) {
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const args = process.argv.slice(2);
|
|
79
|
+
|
|
80
|
+
if (args.length === 0) {
|
|
81
|
+
console.error('Usage: node bun-runner.js <script> [args...]');
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
args[0] = fixBrokenScriptPath(args[0]);
|
|
86
|
+
|
|
87
|
+
const bunPath = findNode();
|
|
88
|
+
|
|
89
|
+
if (!bunPath) {
|
|
90
|
+
console.error('Error: Node not found. Please install Node.js: https://nodejs.org');
|
|
91
|
+
console.error('After installation, restart your terminal.');
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function collectStdin() {
|
|
96
|
+
return new Promise((resolve) => {
|
|
97
|
+
if (process.stdin.isTTY) {
|
|
98
|
+
resolve(null);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const chunks = [];
|
|
103
|
+
process.stdin.on('data', (chunk) => chunks.push(chunk));
|
|
104
|
+
process.stdin.on('end', () => {
|
|
105
|
+
resolve(chunks.length > 0 ? Buffer.concat(chunks) : null);
|
|
106
|
+
});
|
|
107
|
+
process.stdin.on('error', () => {
|
|
108
|
+
resolve(null);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
setTimeout(() => {
|
|
112
|
+
process.stdin.removeAllListeners();
|
|
113
|
+
process.stdin.pause();
|
|
114
|
+
resolve(chunks.length > 0 ? Buffer.concat(chunks) : null);
|
|
115
|
+
}, 5000);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const stdinData = await collectStdin();
|
|
120
|
+
|
|
121
|
+
const spawnOptions = {
|
|
122
|
+
stdio: ['pipe', 'inherit', 'inherit'],
|
|
123
|
+
windowsHide: true,
|
|
124
|
+
env: process.env
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
let spawnCmd = bunPath;
|
|
128
|
+
let spawnArgs = args;
|
|
129
|
+
|
|
130
|
+
if (IS_WINDOWS) {
|
|
131
|
+
const quote = (s) => `"${String(s).replace(/"/g, '\\"')}"`;
|
|
132
|
+
spawnOptions.shell = true;
|
|
133
|
+
spawnCmd = [bunPath, ...args].map(quote).join(' ');
|
|
134
|
+
spawnArgs = [];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const child = spawn(spawnCmd, spawnArgs, spawnOptions);
|
|
138
|
+
|
|
139
|
+
if (child.stdin) {
|
|
140
|
+
if (stdinData && stdinData.length > 0) {
|
|
141
|
+
child.stdin.write(stdinData);
|
|
142
|
+
child.stdin.end();
|
|
143
|
+
} else {
|
|
144
|
+
// Lifecycle subcommands (start, stop, restart, status) never consume stdin —
|
|
145
|
+
// they manage the worker daemon, not hook payloads. Killing the child here
|
|
146
|
+
// prevents the daemon from starting/stopping on platforms where Claude Code
|
|
147
|
+
// doesn't pipe a payload for SessionStart (e.g. Windows CC ≤ 2.1.145).
|
|
148
|
+
const lifecycleCommands = ['start', 'stop', 'restart', 'status'];
|
|
149
|
+
const isLifecycle = lifecycleCommands.some(cmd => args.includes(cmd));
|
|
150
|
+
|
|
151
|
+
if (isLifecycle) {
|
|
152
|
+
// Lifecycle commands don't need stdin — close pipe and let child run.
|
|
153
|
+
try { child.stdin.end(); } catch {}
|
|
154
|
+
} else {
|
|
155
|
+
// Issue #2188: empty/missing stdin previously masked by `|| '{}'` fallback,
|
|
156
|
+
// which silently hid WSL bash failures (e.g. hooks invoked under a broken
|
|
157
|
+
// shell that never piped a payload). Surface the failure mode instead.
|
|
158
|
+
const dataDir = process.env.KEEPMIND_DATA_DIR || process.env.CLAUDE_MEM_DATA_DIR || join(homedir(), '.keepmind');
|
|
159
|
+
const payloadType = stdinData === null
|
|
160
|
+
? 'null (no data event or stream error)'
|
|
161
|
+
: stdinData === undefined
|
|
162
|
+
? 'undefined'
|
|
163
|
+
: Buffer.isBuffer(stdinData) && stdinData.length === 0
|
|
164
|
+
? 'empty Buffer (zero bytes received)'
|
|
165
|
+
: `unexpected (${typeof stdinData})`;
|
|
166
|
+
const payloadByteLength = (stdinData && typeof stdinData.length === 'number')
|
|
167
|
+
? stdinData.length
|
|
168
|
+
: 0;
|
|
169
|
+
const diagnostic = [
|
|
170
|
+
`[bun-runner] empty stdin payload received — issue #2188`,
|
|
171
|
+
` script: ${args[0]}`,
|
|
172
|
+
` payload byte length: ${payloadByteLength}`,
|
|
173
|
+
` payload type: ${payloadType}`,
|
|
174
|
+
` platform: ${process.platform}`,
|
|
175
|
+
` shell: ${process.env.SHELL || 'n/a'}`,
|
|
176
|
+
` stdin TTY: ${process.stdin.isTTY === true ? 'true' : process.stdin.isTTY === false ? 'false' : 'undefined'}`,
|
|
177
|
+
` timestamp: ${new Date().toISOString()}`,
|
|
178
|
+
` CLAUDE_PLUGIN_ROOT: ${RESOLVED_PLUGIN_ROOT}`,
|
|
179
|
+
].join('\n');
|
|
180
|
+
|
|
181
|
+
// IO discipline (see src/shared/hook-io.ts intent vocabulary):
|
|
182
|
+
// - this stderr write is a USER_HINT (Claude Code surfaces it inline).
|
|
183
|
+
// - the CAPTURE_BROKEN marker file below is a DIAGNOSTIC durable signal for
|
|
184
|
+
// the next session-start hint.
|
|
185
|
+
// - exit 0 below is the EXIT_SIGNAL per CLAUDE.md (Windows Terminal tab
|
|
186
|
+
// management); the marker file, not the exit code, is the durable failure
|
|
187
|
+
// signal. bun-runner runs in its own node process BEFORE hookCommand's
|
|
188
|
+
// stderr buffer is installed, so this write is never swallowed.
|
|
189
|
+
|
|
190
|
+
// Write to stderr so Claude Code surfaces the diagnostic.
|
|
191
|
+
console.error(diagnostic);
|
|
192
|
+
|
|
193
|
+
// Persist diagnostic to the runner-errors log and drop a CAPTURE_BROKEN marker
|
|
194
|
+
// file so the next session-start hint can surface the failure. We exit 0 to
|
|
195
|
+
// honor the project's exit-code strategy (worker/hook errors exit 0 to
|
|
196
|
+
// prevent Windows Terminal tab pileup) — the marker file is the durable
|
|
197
|
+
// signal that something is wrong, not the exit code.
|
|
198
|
+
try {
|
|
199
|
+
const logsDir = join(dataDir, 'logs');
|
|
200
|
+
mkdirSync(logsDir, { recursive: true });
|
|
201
|
+
appendFileSync(join(logsDir, 'runner-errors.log'), diagnostic + '\n\n');
|
|
202
|
+
mkdirSync(dataDir, { recursive: true });
|
|
203
|
+
writeFileSync(join(dataDir, 'CAPTURE_BROKEN'), diagnostic + '\n');
|
|
204
|
+
} catch (writeErr) {
|
|
205
|
+
console.error(`[bun-runner] failed to persist diagnostic: ${writeErr && writeErr.message ? writeErr.message : writeErr}`);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
try { child.stdin.end(); } catch {}
|
|
209
|
+
try { child.kill(); } catch {}
|
|
210
|
+
process.exit(0);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
child.on('error', (err) => {
|
|
216
|
+
// EXCEPTION to CLAUDE.md exit-0-on-error: Node-not-found is a user environment
|
|
217
|
+
// problem, not a hook execution failure. Surfacing exit 1 here forces Claude
|
|
218
|
+
// Code to display the stderr message rather than silently retrying. This runs
|
|
219
|
+
// before any hook handler, so the exit-0 tab-management rationale doesn't apply.
|
|
220
|
+
console.error(`Failed to start Node: ${err.message}`);
|
|
221
|
+
process.exit(1);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
child.on('close', (code, signal) => {
|
|
225
|
+
if ((signal || code > 128) && args.includes('start')) {
|
|
226
|
+
process.exit(0);
|
|
227
|
+
}
|
|
228
|
+
process.exit(code || 0);
|
|
229
|
+
});
|