@gamaze/hicortex 0.3.1 → 0.3.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/dist/init.js CHANGED
@@ -97,20 +97,30 @@ async function detect() {
97
97
  // Actions
98
98
  // ---------------------------------------------------------------------------
99
99
  function registerCcMcp(serverUrl) {
100
- let settings = {};
101
100
  try {
102
- settings = JSON.parse((0, node_fs_1.readFileSync)(CC_SETTINGS, "utf-8"));
101
+ // Use claude CLI to register — it knows the correct config format and location
102
+ (0, node_child_process_1.execSync)(`claude mcp add hicortex --transport sse ${serverUrl}/sse`, { encoding: "utf-8", stdio: "pipe" });
103
+ console.log(` ✓ Registered MCP server via claude CLI`);
104
+ }
105
+ catch (err) {
106
+ // Fallback: write directly to settings.json if claude CLI not available
107
+ const msg = err instanceof Error ? err.message : String(err);
108
+ console.log(` ⚠ claude CLI registration failed (${msg}), writing settings.json directly`);
109
+ let settings = {};
110
+ try {
111
+ settings = JSON.parse((0, node_fs_1.readFileSync)(CC_SETTINGS, "utf-8"));
112
+ }
113
+ catch { /* create new */ }
114
+ if (!settings.mcpServers)
115
+ settings.mcpServers = {};
116
+ settings.mcpServers.hicortex = {
117
+ type: "sse",
118
+ url: `${serverUrl}/sse`,
119
+ };
120
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(CC_SETTINGS), { recursive: true });
121
+ (0, node_fs_1.writeFileSync)(CC_SETTINGS, JSON.stringify(settings, null, 2));
122
+ console.log(` ✓ Registered MCP server in ${CC_SETTINGS}`);
103
123
  }
104
- catch { /* create new */ }
105
- if (!settings.mcpServers)
106
- settings.mcpServers = {};
107
- settings.mcpServers.hicortex = {
108
- type: "http",
109
- url: `${serverUrl}/sse`,
110
- };
111
- (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(CC_SETTINGS), { recursive: true });
112
- (0, node_fs_1.writeFileSync)(CC_SETTINGS, JSON.stringify(settings, null, 2));
113
- console.log(` ✓ Registered MCP server in ${CC_SETTINGS}`);
114
124
  }
115
125
  function installCcCommands() {
116
126
  (0, node_fs_1.mkdirSync)(CC_COMMANDS_DIR, { recursive: true });
@@ -156,17 +166,29 @@ Tell them: "Get a license key at https://hicortex.gamaze.com/ — after purchase
156
166
  (0, node_fs_1.writeFileSync)((0, node_path_1.join)(CC_COMMANDS_DIR, "hicortex-activate.md"), activateContent);
157
167
  console.log(` ✓ Installed /learn and /hicortex-activate commands in ${CC_COMMANDS_DIR}`);
158
168
  }
169
+ function getPackageVersion() {
170
+ try {
171
+ const pkgPath = (0, node_path_1.join)(__dirname, "..", "package.json");
172
+ const pkg = JSON.parse((0, node_fs_1.readFileSync)(pkgPath, "utf-8"));
173
+ return pkg.version ?? "latest";
174
+ }
175
+ catch {
176
+ return "latest";
177
+ }
178
+ }
159
179
  function installDaemon() {
160
180
  const os = (0, node_os_1.platform)();
161
181
  const npxPath = findNpxPath();
182
+ const version = getPackageVersion();
183
+ const packageSpec = `@gamaze/hicortex@${version}`;
162
184
  if (os === "darwin") {
163
- return installLaunchd(npxPath);
185
+ return installLaunchd(npxPath, packageSpec);
164
186
  }
165
187
  else if (os === "linux") {
166
- return installSystemd(npxPath);
188
+ return installSystemd(npxPath, packageSpec);
167
189
  }
168
190
  else {
169
- console.log(` ⚠ Unsupported platform: ${os}. Start the server manually: npx @gamaze/hicortex server`);
191
+ console.log(` ⚠ Unsupported platform: ${os}. Start the server manually: npx ${packageSpec} server`);
170
192
  return false;
171
193
  }
172
194
  }
@@ -178,7 +200,7 @@ function findNpxPath() {
178
200
  return "/usr/local/bin/npx";
179
201
  }
180
202
  }
181
- function installLaunchd(npxPath) {
203
+ function installLaunchd(npxPath, packageSpec) {
182
204
  const plistDir = (0, node_path_1.join)((0, node_os_1.homedir)(), "Library", "LaunchAgents");
183
205
  const plistPath = (0, node_path_1.join)(plistDir, "com.gamaze.hicortex.plist");
184
206
  const logPath = (0, node_path_1.join)(HICORTEX_HOME, "server.log");
@@ -193,7 +215,7 @@ function installLaunchd(npxPath) {
193
215
  <array>
194
216
  <string>${npxPath}</string>
195
217
  <string>-y</string>
196
- <string>@gamaze/hicortex</string>
218
+ <string>${packageSpec}</string>
197
219
  <string>server</string>
198
220
  </array>
199
221
  <key>KeepAlive</key>
@@ -229,7 +251,7 @@ function installLaunchd(npxPath) {
229
251
  return false;
230
252
  }
231
253
  }
232
- function installSystemd(npxPath) {
254
+ function installSystemd(npxPath, packageSpec) {
233
255
  const unitDir = (0, node_path_1.join)((0, node_os_1.homedir)(), ".config", "systemd", "user");
234
256
  const servicePath = (0, node_path_1.join)(unitDir, "hicortex.service");
235
257
  const service = `[Unit]
@@ -237,7 +259,7 @@ Description=Hicortex MCP server — long-term memory for AI agents
237
259
 
238
260
  [Service]
239
261
  Type=simple
240
- ExecStart=${npxPath} -y @gamaze/hicortex server
262
+ ExecStart=${npxPath} -y ${packageSpec} server
241
263
  Restart=on-failure
242
264
  RestartSec=10
243
265
  StandardOutput=journal
@@ -2,7 +2,7 @@
2
2
  "id": "hicortex",
3
3
  "name": "Hicortex — Long-term Memory That Learns",
4
4
  "description": "Your agents remember past decisions, avoid repeated mistakes, and get smarter every day. Nightly reflection generates actionable lessons that automatically update agent behavior.",
5
- "version": "0.3.1",
5
+ "version": "0.3.3",
6
6
  "kind": "lifecycle",
7
7
  "skills": ["./skills/hicortex-memory", "./skills/hicortex-learn", "./skills/hicortex-activate"],
8
8
  "configSchema": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamaze/hicortex",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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": {