claude-cup 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.
@@ -28,9 +28,9 @@ function deepMergeOnlyOurKeys(target, our) {
28
28
  result.hooks = { ...(target.hooks || {}) };
29
29
  for (const [k, arr] of Object.entries(our.hooks)) {
30
30
  const existing = Array.isArray(result.hooks[k]) ? result.hooks[k] : [];
31
- const seen = new Set(existing.map(e => JSON.stringify({ c: e.command, a: e.args })));
31
+ const seen = new Set(existing.map(e => JSON.stringify(e)));
32
32
  for (const item of arr) {
33
- const key = JSON.stringify({ c: item.command, a: item.args });
33
+ const key = JSON.stringify(item);
34
34
  if (!seen.has(key)) {
35
35
  existing.push(item);
36
36
  seen.add(key);
@@ -68,9 +68,9 @@ export function registerClaudeCode(configDir) {
68
68
  },
69
69
  },
70
70
  hooks: {
71
- SessionStart: [{ command: 'node', args: [launcher, '--hook', 'SessionStart'] }],
72
- PreToolUse: [{ command: 'node', args: [launcher, '--hook', 'PreToolUse'] }],
73
- PostToolUse: [{ command: 'node', args: [launcher, '--hook', 'PostToolUse'] }],
71
+ SessionStart: [{ matcher: '', hooks: [{ type: 'command', command: `node ${launcher} --hook SessionStart` }] }],
72
+ PreToolUse: [{ matcher: '', hooks: [{ type: 'command', command: `node ${launcher} --hook PreToolUse` }] }],
73
+ PostToolUse: [{ matcher: '', hooks: [{ type: 'command', command: `node ${launcher} --hook PostToolUse` }] }],
74
74
  },
75
75
  };
76
76
 
@@ -78,7 +78,7 @@ export function registerClaudeCode(configDir) {
78
78
  let backup = null;
79
79
  try {
80
80
  if (existsSync(settingsPath)) {
81
- const raw = readFileSync(settingsPath, 'utf8');
81
+ const raw = readFileSync(settingsPath, 'utf8').replace(/^\uFEFF/, '');
82
82
  if (raw.trim()) original = JSON.parse(raw);
83
83
  }
84
84
  } catch (e) {
@@ -117,7 +117,7 @@ export function disableClaudeCode(configDir) {
117
117
 
118
118
  let settings = {};
119
119
  if (existsSync(settingsPath)) {
120
- try { settings = JSON.parse(readFileSync(settingsPath, 'utf8')); } catch { return { ok: false, error: 'corrupt settings.json', didWrite: false, backupPath: null, launcherPath: launcher }; }
120
+ try { settings = JSON.parse(readFileSync(settingsPath, 'utf8').replace(/^\uFEFF/, '')); } catch { return { ok: false, error: 'corrupt settings.json', didWrite: false, backupPath: null, launcherPath: launcher }; }
121
121
  }
122
122
 
123
123
  let changed = false;
@@ -129,10 +129,10 @@ export function disableClaudeCode(configDir) {
129
129
  if (settings.hooks) {
130
130
  const launcherBase = 'mcp-server.mjs';
131
131
  for (const k of Object.keys(settings.hooks)) {
132
- settings.hooks[k] = (settings.hooks[k] || []).filter(h => {
133
- if (!h || !h.args) return true;
134
- const argsStr = JSON.stringify(h.args);
135
- return !argsStr.includes(launcherBase);
132
+ settings.hooks[k] = (settings.hooks[k] || []).filter(rule => {
133
+ if (!rule) return true;
134
+ const ruleStr = JSON.stringify(rule);
135
+ return !ruleStr.includes(launcherBase);
136
136
  });
137
137
  if (settings.hooks[k].length === 0) delete settings.hooks[k];
138
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-cup",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Claude Jar v2 — native desktop visual companion (Tauri + Svelte) with MCP/hook integration for live Claude activity. Beautiful accumulating jar + live intensity meter. The jar is the usage meter.",
5
5
  "license": "MIT",
6
6
  "type": "module",