@cohaku/cli 0.2.8 → 0.2.10
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/{chunk-SJZY3OAT.js → chunk-L63I4DKW.js} +1 -1
- package/dist/{chunk-ZELLRTG5.js → chunk-NB6QOARI.js} +1 -1
- package/dist/chunk-O5TCSRSD.js +39 -0
- package/dist/{chunk-MU3X6KBC.js → chunk-YNSEADV6.js} +1 -1
- package/dist/index.js +9 -5
- package/dist/init-UZICSKDK.js +74 -0
- package/dist/{mcp-OUXSA2GV.js → mcp-HPHXYCLI.js} +3 -3
- package/dist/{serve-2QVCMO3C.js → serve-3SE3ZUHO.js} +2 -2
- package/dist/{start-S5JBNPBO.js → start-IO2DUWXP.js} +11 -3
- package/dist/{status-NYW3OOGW.js → status-T54UJ2L2.js} +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/shared/mcp-registration.ts
|
|
4
|
+
import { execSync } from "child_process";
|
|
5
|
+
function hasClaude() {
|
|
6
|
+
try {
|
|
7
|
+
execSync("claude --version", { stdio: ["pipe", "pipe", "pipe"] });
|
|
8
|
+
return true;
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function isClaudeMcpRegistered() {
|
|
14
|
+
try {
|
|
15
|
+
const output = execSync("claude mcp list 2>&1", {
|
|
16
|
+
encoding: "utf-8",
|
|
17
|
+
shell: "/bin/sh"
|
|
18
|
+
});
|
|
19
|
+
return output.includes("cohaku");
|
|
20
|
+
} catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function registerMcp() {
|
|
25
|
+
try {
|
|
26
|
+
execSync("claude mcp add cohaku -- cohaku mcp", {
|
|
27
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
28
|
+
});
|
|
29
|
+
return true;
|
|
30
|
+
} catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
hasClaude,
|
|
37
|
+
isClaudeMcpRegistered,
|
|
38
|
+
registerMcp
|
|
39
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__commonJS,
|
|
6
6
|
__require,
|
|
7
7
|
__toESM
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NB6QOARI.js";
|
|
9
9
|
|
|
10
10
|
// ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/error.js
|
|
11
11
|
var require_error = __commonJS({
|
|
@@ -3460,20 +3460,24 @@ var {
|
|
|
3460
3460
|
// src/index.ts
|
|
3461
3461
|
var program2 = new Command();
|
|
3462
3462
|
program2.name("cohaku").description("Cohaku AI \u2014 persistent memory layer for coding agents").version(VERSION);
|
|
3463
|
+
program2.command("init").description("Initialize Cohaku for this project").action(async () => {
|
|
3464
|
+
const { initCommand } = await import("./init-UZICSKDK.js");
|
|
3465
|
+
await initCommand();
|
|
3466
|
+
});
|
|
3463
3467
|
program2.command("mcp").description("Start MCP server (stdio transport)").action(async () => {
|
|
3464
|
-
const { mcpCommand } = await import("./mcp-
|
|
3468
|
+
const { mcpCommand } = await import("./mcp-HPHXYCLI.js");
|
|
3465
3469
|
await mcpCommand();
|
|
3466
3470
|
});
|
|
3467
3471
|
program2.command("start").description("Start MCP server + dashboard together").option("-p, --port <port>", "Dashboard port", String(24200)).action(async (opts) => {
|
|
3468
|
-
const { startCommand } = await import("./start-
|
|
3472
|
+
const { startCommand } = await import("./start-IO2DUWXP.js");
|
|
3469
3473
|
await startCommand({ port: Number(opts.port) });
|
|
3470
3474
|
});
|
|
3471
3475
|
program2.command("serve").description("Start HTTP API server with dashboard (no MCP)").option("-p, --port <port>", "Port number", String(24200)).action(async (opts) => {
|
|
3472
|
-
const { serveCommand } = await import("./serve-
|
|
3476
|
+
const { serveCommand } = await import("./serve-3SE3ZUHO.js");
|
|
3473
3477
|
await serveCommand({ port: Number(opts.port) });
|
|
3474
3478
|
});
|
|
3475
3479
|
program2.command("status").description("Show current status and memory statistics").action(async () => {
|
|
3476
|
-
const { statusCommand } = await import("./status-
|
|
3480
|
+
const { statusCommand } = await import("./status-T54UJ2L2.js");
|
|
3477
3481
|
await statusCommand();
|
|
3478
3482
|
});
|
|
3479
3483
|
program2.parse();
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
hasClaude,
|
|
4
|
+
isClaudeMcpRegistered,
|
|
5
|
+
registerMcp
|
|
6
|
+
} from "./chunk-O5TCSRSD.js";
|
|
7
|
+
import {
|
|
8
|
+
createEngine
|
|
9
|
+
} from "./chunk-HUMYWLCL.js";
|
|
10
|
+
import {
|
|
11
|
+
VERSION
|
|
12
|
+
} from "./chunk-NB6QOARI.js";
|
|
13
|
+
|
|
14
|
+
// src/commands/init.ts
|
|
15
|
+
var c = {
|
|
16
|
+
reset: "\x1B[0m",
|
|
17
|
+
bold: "\x1B[1m",
|
|
18
|
+
dim: "\x1B[2m",
|
|
19
|
+
amber: "\x1B[38;5;214m",
|
|
20
|
+
green: "\x1B[38;5;114m",
|
|
21
|
+
red: "\x1B[38;5;203m",
|
|
22
|
+
white: "\x1B[97m",
|
|
23
|
+
gray: "\x1B[38;5;245m"
|
|
24
|
+
};
|
|
25
|
+
async function initCommand() {
|
|
26
|
+
process.stderr.write(`
|
|
27
|
+
${c.amber}${c.bold}\u25C6 Cohaku AI${c.reset} ${c.dim}v${VERSION}${c.reset}
|
|
28
|
+
|
|
29
|
+
`);
|
|
30
|
+
process.stderr.write(` ${c.dim}Initializing database...${c.reset}`);
|
|
31
|
+
try {
|
|
32
|
+
const { engine } = await createEngine();
|
|
33
|
+
engine.close();
|
|
34
|
+
process.stderr.write(` ${c.green}done${c.reset}
|
|
35
|
+
`);
|
|
36
|
+
} catch (err) {
|
|
37
|
+
process.stderr.write(` ${c.red}failed${c.reset}
|
|
38
|
+
`);
|
|
39
|
+
process.stderr.write(` ${c.red}${err instanceof Error ? err.message : String(err)}${c.reset}
|
|
40
|
+
|
|
41
|
+
`);
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
if (!hasClaude()) {
|
|
45
|
+
process.stderr.write(` ${c.dim}Claude Code not found \u2014 skipping MCP registration${c.reset}
|
|
46
|
+
`);
|
|
47
|
+
process.stderr.write(` ${c.dim}Install Claude Code, then run: claude mcp add cohaku -- cohaku mcp${c.reset}
|
|
48
|
+
|
|
49
|
+
`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (isClaudeMcpRegistered()) {
|
|
53
|
+
process.stderr.write(` ${c.dim}MCP server already registered${c.reset}
|
|
54
|
+
`);
|
|
55
|
+
} else {
|
|
56
|
+
process.stderr.write(` ${c.dim}Registering MCP server...${c.reset}`);
|
|
57
|
+
if (registerMcp()) {
|
|
58
|
+
process.stderr.write(` ${c.green}done${c.reset}
|
|
59
|
+
`);
|
|
60
|
+
} else {
|
|
61
|
+
process.stderr.write(` ${c.red}failed${c.reset}
|
|
62
|
+
`);
|
|
63
|
+
process.stderr.write(` ${c.dim}Run manually: claude mcp add cohaku -- cohaku mcp${c.reset}
|
|
64
|
+
`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
process.stderr.write(`
|
|
68
|
+
${c.green}\u25CF${c.reset} ${c.white}Ready${c.reset} ${c.dim}\u2014 restart Claude Code to activate${c.reset}
|
|
69
|
+
|
|
70
|
+
`);
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
initCommand
|
|
74
|
+
};
|
|
@@ -2,15 +2,15 @@ import { createRequire } from 'module'; const require = createRequire(import.met
|
|
|
2
2
|
import {
|
|
3
3
|
StdioServerTransport,
|
|
4
4
|
createServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YNSEADV6.js";
|
|
6
6
|
import {
|
|
7
7
|
checkForUpdate,
|
|
8
8
|
printBanner
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-L63I4DKW.js";
|
|
10
10
|
import {
|
|
11
11
|
createEngine
|
|
12
12
|
} from "./chunk-HUMYWLCL.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-NB6QOARI.js";
|
|
14
14
|
|
|
15
15
|
// src/commands/mcp.ts
|
|
16
16
|
async function mcpCommand() {
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
checkForUpdate,
|
|
8
8
|
printBanner
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-L63I4DKW.js";
|
|
10
10
|
import {
|
|
11
11
|
createEngine
|
|
12
12
|
} from "./chunk-HUMYWLCL.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-NB6QOARI.js";
|
|
14
14
|
|
|
15
15
|
// src/commands/serve.ts
|
|
16
16
|
import { join, dirname } from "path";
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
hasClaude,
|
|
4
|
+
isClaudeMcpRegistered,
|
|
5
|
+
registerMcp
|
|
6
|
+
} from "./chunk-O5TCSRSD.js";
|
|
2
7
|
import {
|
|
3
8
|
StdioServerTransport,
|
|
4
9
|
createServer
|
|
5
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YNSEADV6.js";
|
|
6
11
|
import {
|
|
7
12
|
createApi,
|
|
8
13
|
serve
|
|
@@ -10,11 +15,11 @@ import {
|
|
|
10
15
|
import {
|
|
11
16
|
checkForUpdate,
|
|
12
17
|
printBanner
|
|
13
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-L63I4DKW.js";
|
|
14
19
|
import {
|
|
15
20
|
createEngine
|
|
16
21
|
} from "./chunk-HUMYWLCL.js";
|
|
17
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-NB6QOARI.js";
|
|
18
23
|
|
|
19
24
|
// src/commands/start.ts
|
|
20
25
|
import { join, dirname } from "path";
|
|
@@ -60,6 +65,9 @@ async function startCommand(opts) {
|
|
|
60
65
|
dashboardUrl = `http://localhost:${port}`;
|
|
61
66
|
} catch {
|
|
62
67
|
}
|
|
68
|
+
if (hasClaude() && !isClaudeMcpRegistered()) {
|
|
69
|
+
registerMcp();
|
|
70
|
+
}
|
|
63
71
|
const latestVersion = await checkForUpdate();
|
|
64
72
|
printBanner({
|
|
65
73
|
projectId,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cohaku/cli",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "CLI for Cohaku AI
|
|
3
|
+
"version": "0.2.10",
|
|
4
|
+
"description": "CLI for Cohaku AI \u2014 persistent memory layer for coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@cohaku/api": "workspace:*",
|
|
40
|
-
"@cohaku/dashboard": "workspace:*",
|
|
41
40
|
"@cohaku/core": "workspace:*",
|
|
41
|
+
"@cohaku/dashboard": "workspace:*",
|
|
42
42
|
"@cohaku/mcp": "workspace:*",
|
|
43
43
|
"@cohaku/shared": "workspace:*",
|
|
44
44
|
"@hono/node-server": "^1.14.0",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"nanoid": "^5.1.6",
|
|
51
51
|
"tsup": "^8.5.0",
|
|
52
52
|
"typescript": "^5.7.0",
|
|
53
|
+
"vitest": "^4.0.18",
|
|
53
54
|
"zod": "^4.3.6"
|
|
54
55
|
}
|
|
55
56
|
}
|