@gamaze/hicortex 0.3.14 → 0.3.15

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.
Files changed (2) hide show
  1. package/dist/init.js +32 -8
  2. package/package.json +1 -1
package/dist/init.js CHANGED
@@ -116,23 +116,45 @@ function registerCcMcp(serverUrl) {
116
116
  console.log(` ✓ Registered MCP server via claude CLI`);
117
117
  }
118
118
  catch (err) {
119
- // Fallback: write directly to settings.json if claude CLI not available
119
+ // Fallback: write directly to ~/.claude.json (where CC reads MCP servers)
120
120
  const msg = err instanceof Error ? err.message : String(err);
121
- console.log(` ⚠ claude CLI registration failed (${msg}), writing settings.json directly`);
122
- let settings = {};
121
+ console.log(` ⚠ claude CLI registration failed (${msg}), writing ~/.claude.json directly`);
122
+ const claudeJsonPath = (0, node_path_1.join)((0, node_os_1.homedir)(), ".claude.json");
123
+ let config = {};
123
124
  try {
124
- settings = JSON.parse((0, node_fs_1.readFileSync)(CC_SETTINGS, "utf-8"));
125
+ config = JSON.parse((0, node_fs_1.readFileSync)(claudeJsonPath, "utf-8"));
125
126
  }
126
127
  catch { /* create new */ }
127
- if (!settings.mcpServers)
128
- settings.mcpServers = {};
129
- settings.mcpServers.hicortex = {
128
+ if (!config.mcpServers)
129
+ config.mcpServers = {};
130
+ config.mcpServers.hicortex = {
130
131
  type: "sse",
131
132
  url: `${serverUrl}/sse`,
132
133
  };
134
+ (0, node_fs_1.writeFileSync)(claudeJsonPath, JSON.stringify(config, null, 2));
135
+ console.log(` ✓ Registered MCP server in ${claudeJsonPath}`);
136
+ }
137
+ // Add MCP tool permissions to settings.json so users don't get prompted
138
+ allowHicortexTools();
139
+ }
140
+ function allowHicortexTools() {
141
+ let settings = {};
142
+ try {
143
+ settings = JSON.parse((0, node_fs_1.readFileSync)(CC_SETTINGS, "utf-8"));
144
+ }
145
+ catch { /* create new */ }
146
+ if (!settings.permissions)
147
+ settings.permissions = {};
148
+ const perms = settings.permissions;
149
+ if (!perms.allow)
150
+ perms.allow = [];
151
+ const allow = perms.allow;
152
+ const rule = "mcp__hicortex__*";
153
+ if (!allow.includes(rule)) {
154
+ allow.push(rule);
133
155
  (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(CC_SETTINGS), { recursive: true });
134
156
  (0, node_fs_1.writeFileSync)(CC_SETTINGS, JSON.stringify(settings, null, 2));
135
- console.log(` ✓ Registered MCP server in ${CC_SETTINGS}`);
157
+ console.log(` ✓ Added Hicortex tool permissions to ${CC_SETTINGS}`);
136
158
  }
137
159
  }
138
160
  function installCcCommands() {
@@ -587,6 +609,8 @@ async function runInit() {
587
609
  if (!d.ccMcpRegistered) {
588
610
  registerCcMcp(serverUrl);
589
611
  }
612
+ // Ensure tool permissions are set (also needed for users upgrading from older versions)
613
+ allowHicortexTools();
590
614
  // Install CC commands
591
615
  installCcCommands();
592
616
  // Inject CLAUDE.md (only if server has a DB we can read)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamaze/hicortex",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "description": "Human-like memory for self-improving AI agents. Automatic capturing, nightly reflection, and cross-agent learning. Works with Claude Code and OpenClaw.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {