@bjlee2024/claude-mem 13.4.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 +419 -0
- package/dist/npx-cli/index.js +10001 -0
- package/dist/opencode-plugin/index.js +67 -0
- package/openclaw/Dockerfile.e2e +46 -0
- package/openclaw/SKILL.md +462 -0
- package/openclaw/TESTING.md +279 -0
- package/openclaw/dist/index.js +15 -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/src/index.test.ts +1124 -0
- package/openclaw/src/index.ts +1092 -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 +211 -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/hooks/bugfixes-2026-01-10.md +92 -0
- package/plugin/hooks/codex-hooks.json +74 -0
- package/plugin/hooks/hooks.json +87 -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 +46 -0
- package/plugin/scripts/bun-runner.js +216 -0
- package/plugin/scripts/context-generator.cjs +795 -0
- package/plugin/scripts/mcp-server.cjs +239 -0
- package/plugin/scripts/server-beta-service.cjs +9856 -0
- package/plugin/scripts/statusline-counts.js +40 -0
- package/plugin/scripts/version-check.js +69 -0
- package/plugin/scripts/worker-cli.js +19 -0
- package/plugin/scripts/worker-service.cjs +2368 -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 +190 -0
- package/plugin/skills/timeline-report/SKILL.md +211 -0
- package/plugin/skills/version-bump/SKILL.md +68 -0
- package/plugin/skills/version-bump/scripts/generate_changelog.js +34 -0
- package/plugin/skills/weekly-digests/SKILL.md +262 -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/claude-mem-logo-for-dark-mode.webp +0 -0
- package/plugin/ui/claude-mem-logo-stylized.png +0 -0
- package/plugin/ui/claude-mem-logomark.webp +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 +3145 -0
|
@@ -0,0 +1,216 @@
|
|
|
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 findBun() {
|
|
24
|
+
const pathCheck = IS_WINDOWS
|
|
25
|
+
? spawnSync('where bun', {
|
|
26
|
+
encoding: 'utf-8',
|
|
27
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
28
|
+
shell: true
|
|
29
|
+
})
|
|
30
|
+
: spawnSync('which', ['bun'], {
|
|
31
|
+
encoding: 'utf-8',
|
|
32
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (pathCheck.status === 0 && pathCheck.stdout.trim()) {
|
|
36
|
+
if (IS_WINDOWS) {
|
|
37
|
+
const bunCmdPath = pathCheck.stdout.split('\n').find(line => line.trim().endsWith('bun.cmd'));
|
|
38
|
+
if (bunCmdPath) {
|
|
39
|
+
return bunCmdPath.trim();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return 'bun';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const bunPaths = IS_WINDOWS
|
|
46
|
+
? [join(homedir(), '.bun', 'bin', 'bun.exe')]
|
|
47
|
+
: [
|
|
48
|
+
join(homedir(), '.bun', 'bin', 'bun'),
|
|
49
|
+
'/usr/local/bin/bun',
|
|
50
|
+
'/opt/homebrew/bin/bun',
|
|
51
|
+
'/home/linuxbrew/.linuxbrew/bin/bun'
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
for (const bunPath of bunPaths) {
|
|
55
|
+
if (existsSync(bunPath)) {
|
|
56
|
+
return bunPath;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isPluginDisabledInClaudeSettings() {
|
|
64
|
+
try {
|
|
65
|
+
const configDir = process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude');
|
|
66
|
+
const settingsPath = join(configDir, 'settings.json');
|
|
67
|
+
if (!existsSync(settingsPath)) return false;
|
|
68
|
+
const settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
69
|
+
return settings?.enabledPlugins?.['claude-mem@bjlee2024'] === false;
|
|
70
|
+
} catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (isPluginDisabledInClaudeSettings()) {
|
|
76
|
+
process.exit(0);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const args = process.argv.slice(2);
|
|
80
|
+
|
|
81
|
+
if (args.length === 0) {
|
|
82
|
+
console.error('Usage: node bun-runner.js <script> [args...]');
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
args[0] = fixBrokenScriptPath(args[0]);
|
|
87
|
+
|
|
88
|
+
const bunPath = findBun();
|
|
89
|
+
|
|
90
|
+
if (!bunPath) {
|
|
91
|
+
console.error('Error: Bun not found. Please install Bun: https://bun.sh');
|
|
92
|
+
console.error('After installation, restart your terminal.');
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function collectStdin() {
|
|
97
|
+
return new Promise((resolve) => {
|
|
98
|
+
if (process.stdin.isTTY) {
|
|
99
|
+
resolve(null);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const chunks = [];
|
|
104
|
+
process.stdin.on('data', (chunk) => chunks.push(chunk));
|
|
105
|
+
process.stdin.on('end', () => {
|
|
106
|
+
resolve(chunks.length > 0 ? Buffer.concat(chunks) : null);
|
|
107
|
+
});
|
|
108
|
+
process.stdin.on('error', () => {
|
|
109
|
+
resolve(null);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
process.stdin.removeAllListeners();
|
|
114
|
+
process.stdin.pause();
|
|
115
|
+
resolve(chunks.length > 0 ? Buffer.concat(chunks) : null);
|
|
116
|
+
}, 5000);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const stdinData = await collectStdin();
|
|
121
|
+
|
|
122
|
+
const spawnOptions = {
|
|
123
|
+
stdio: ['pipe', 'inherit', 'inherit'],
|
|
124
|
+
windowsHide: true,
|
|
125
|
+
env: process.env
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
let spawnCmd = bunPath;
|
|
129
|
+
let spawnArgs = args;
|
|
130
|
+
|
|
131
|
+
if (IS_WINDOWS) {
|
|
132
|
+
const quote = (s) => `"${String(s).replace(/"/g, '\\"')}"`;
|
|
133
|
+
spawnOptions.shell = true;
|
|
134
|
+
spawnCmd = [bunPath, ...args].map(quote).join(' ');
|
|
135
|
+
spawnArgs = [];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const child = spawn(spawnCmd, spawnArgs, spawnOptions);
|
|
139
|
+
|
|
140
|
+
if (child.stdin) {
|
|
141
|
+
if (stdinData && stdinData.length > 0) {
|
|
142
|
+
child.stdin.write(stdinData);
|
|
143
|
+
child.stdin.end();
|
|
144
|
+
} else {
|
|
145
|
+
// Issue #2188: empty/missing stdin previously masked by `|| '{}'` fallback,
|
|
146
|
+
// which silently hid WSL bash failures (e.g. hooks invoked under a broken
|
|
147
|
+
// shell that never piped a payload). Surface the failure mode instead.
|
|
148
|
+
const dataDir = process.env.CLAUDE_MEM_DATA_DIR || join(homedir(), '.claude-mem');
|
|
149
|
+
const payloadType = stdinData === null
|
|
150
|
+
? 'null (no data event or stream error)'
|
|
151
|
+
: stdinData === undefined
|
|
152
|
+
? 'undefined'
|
|
153
|
+
: Buffer.isBuffer(stdinData) && stdinData.length === 0
|
|
154
|
+
? 'empty Buffer (zero bytes received)'
|
|
155
|
+
: `unexpected (${typeof stdinData})`;
|
|
156
|
+
const payloadByteLength = (stdinData && typeof stdinData.length === 'number')
|
|
157
|
+
? stdinData.length
|
|
158
|
+
: 0;
|
|
159
|
+
const diagnostic = [
|
|
160
|
+
`[bun-runner] empty stdin payload received — issue #2188`,
|
|
161
|
+
` script: ${args[0]}`,
|
|
162
|
+
` payload byte length: ${payloadByteLength}`,
|
|
163
|
+
` payload type: ${payloadType}`,
|
|
164
|
+
` platform: ${process.platform}`,
|
|
165
|
+
` shell: ${process.env.SHELL || 'n/a'}`,
|
|
166
|
+
` stdin TTY: ${process.stdin.isTTY === true ? 'true' : process.stdin.isTTY === false ? 'false' : 'undefined'}`,
|
|
167
|
+
` timestamp: ${new Date().toISOString()}`,
|
|
168
|
+
` CLAUDE_PLUGIN_ROOT: ${RESOLVED_PLUGIN_ROOT}`,
|
|
169
|
+
].join('\n');
|
|
170
|
+
|
|
171
|
+
// IO discipline (see src/shared/hook-io.ts intent vocabulary):
|
|
172
|
+
// - this stderr write is a USER_HINT (Claude Code surfaces it inline).
|
|
173
|
+
// - the CAPTURE_BROKEN marker file below is a DIAGNOSTIC durable signal for
|
|
174
|
+
// the next session-start hint.
|
|
175
|
+
// - exit 0 below is the EXIT_SIGNAL per CLAUDE.md (Windows Terminal tab
|
|
176
|
+
// management); the marker file, not the exit code, is the durable failure
|
|
177
|
+
// signal. bun-runner runs in its own node process BEFORE hookCommand's
|
|
178
|
+
// stderr buffer is installed, so this write is never swallowed.
|
|
179
|
+
console.error(diagnostic);
|
|
180
|
+
|
|
181
|
+
// Persist diagnostic to the runner-errors log and drop a CAPTURE_BROKEN marker
|
|
182
|
+
// file so the next session-start hint can surface the failure. We exit 0 to
|
|
183
|
+
// honor the project's exit-code strategy (worker/hook errors exit 0 to
|
|
184
|
+
// prevent Windows Terminal tab pileup) — the marker file is the durable
|
|
185
|
+
// signal that something is wrong, not the exit code.
|
|
186
|
+
try {
|
|
187
|
+
const logsDir = join(dataDir, 'logs');
|
|
188
|
+
mkdirSync(logsDir, { recursive: true });
|
|
189
|
+
appendFileSync(join(logsDir, 'runner-errors.log'), diagnostic + '\n\n');
|
|
190
|
+
mkdirSync(dataDir, { recursive: true });
|
|
191
|
+
writeFileSync(join(dataDir, 'CAPTURE_BROKEN'), diagnostic + '\n');
|
|
192
|
+
} catch (writeErr) {
|
|
193
|
+
console.error(`[bun-runner] failed to persist diagnostic: ${writeErr && writeErr.message ? writeErr.message : writeErr}`);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
try { child.stdin.end(); } catch {}
|
|
197
|
+
try { child.kill(); } catch {}
|
|
198
|
+
process.exit(0);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
child.on('error', (err) => {
|
|
203
|
+
// EXCEPTION to CLAUDE.md exit-0-on-error: Bun-not-found is a user environment
|
|
204
|
+
// problem, not a hook execution failure. Surfacing exit 1 here forces Claude
|
|
205
|
+
// Code to display the stderr message rather than silently retrying. This runs
|
|
206
|
+
// before any hook handler, so the exit-0 tab-management rationale doesn't apply.
|
|
207
|
+
console.error(`Failed to start Bun: ${err.message}`);
|
|
208
|
+
process.exit(1);
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
child.on('close', (code, signal) => {
|
|
212
|
+
if ((signal || code > 128) && args.includes('start')) {
|
|
213
|
+
process.exit(0);
|
|
214
|
+
}
|
|
215
|
+
process.exit(code || 0);
|
|
216
|
+
});
|