cortex-sync 0.2.0 → 0.3.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/README.md +13 -5
- package/dist/cli.js +39 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -59,20 +59,28 @@ Open any project on Machine B — Claude Code shows your full session history.
|
|
|
59
59
|
| `cortex pull` | Download, decrypt, remap paths |
|
|
60
60
|
| `cortex status` | Show what's out of sync (no download) |
|
|
61
61
|
| `cortex convert <file> --to <target>` | Convert a Claude Code skill |
|
|
62
|
+
| `cortex setup-mcp` | Register cortex as a Claude Code MCP server |
|
|
62
63
|
|
|
63
64
|
---
|
|
64
65
|
|
|
65
66
|
## Claude Code MCP integration
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
Use `sync`, `pull`, `status`, `convert`, and `init` directly from the Claude Code chat — one command does everything:
|
|
68
69
|
|
|
69
70
|
```bash
|
|
70
71
|
npm install -g cortex-sync
|
|
71
|
-
cortex init
|
|
72
|
-
|
|
73
|
-
claude mcp add cortex -- cortex mcp # register in Claude Code
|
|
72
|
+
cortex init # configure storage and passphrase
|
|
73
|
+
cortex setup-mcp # registers cortex in Claude Code automatically
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
That's it. Restart Claude Code and you're done.
|
|
77
|
+
|
|
78
|
+
### What setup-mcp does
|
|
79
|
+
|
|
80
|
+
`cortex setup-mcp` detects the binary path, prompts for your passphrase once, and runs `claude mcp add` with the correct arguments — no manual PATH configuration needed.
|
|
81
|
+
|
|
82
|
+
### Available MCP tools
|
|
83
|
+
|
|
76
84
|
| Tool | What it does |
|
|
77
85
|
|---|---|
|
|
78
86
|
| `sync` | Encrypt and upload `~/.claude/` |
|
|
@@ -81,7 +89,7 @@ claude mcp add cortex -- cortex mcp # register in Claude Code
|
|
|
81
89
|
| `convert` | Convert a skill to Antigravity or Cursor |
|
|
82
90
|
| `init` | Configure storage (non-interactive) |
|
|
83
91
|
|
|
84
|
-
|
|
92
|
+
### Environment variables (advanced / manual setup)
|
|
85
93
|
|
|
86
94
|
| Variable | Required for |
|
|
87
95
|
|---|---|
|
package/dist/cli.js
CHANGED
|
@@ -1302,6 +1302,44 @@ ${lines.join("\n")}`
|
|
|
1302
1302
|
});
|
|
1303
1303
|
}
|
|
1304
1304
|
|
|
1305
|
+
// src/commands/setup-mcp.ts
|
|
1306
|
+
import { password as password4 } from "@inquirer/prompts";
|
|
1307
|
+
import { existsSync as existsSync7 } from "fs";
|
|
1308
|
+
import { spawnSync } from "child_process";
|
|
1309
|
+
import { dirname as dirname6, join as join11 } from "path";
|
|
1310
|
+
async function setupMcpCommand() {
|
|
1311
|
+
const cortexBin = join11(dirname6(process.execPath), "cortex");
|
|
1312
|
+
if (!existsSync7(cortexBin)) {
|
|
1313
|
+
throw new Error(
|
|
1314
|
+
`cortex binary not found at ${cortexBin}.
|
|
1315
|
+
Make sure cortex-sync is installed globally: npm install -g cortex-sync`
|
|
1316
|
+
);
|
|
1317
|
+
}
|
|
1318
|
+
console.log(`Found cortex at: ${cortexBin}`);
|
|
1319
|
+
const passphrase = await password4({
|
|
1320
|
+
message: "Encryption passphrase (same one used in cortex init):",
|
|
1321
|
+
mask: "*",
|
|
1322
|
+
validate: (v) => v.length >= 12 || "Minimum 12 characters"
|
|
1323
|
+
});
|
|
1324
|
+
const result = spawnSync(
|
|
1325
|
+
"claude",
|
|
1326
|
+
["mcp", "add", "cortex", "-e", `CORTEX_PASSPHRASE=${passphrase}`, "--", cortexBin, "mcp"],
|
|
1327
|
+
{ stdio: "inherit" }
|
|
1328
|
+
);
|
|
1329
|
+
if (result.error) {
|
|
1330
|
+
throw new Error(
|
|
1331
|
+
`Failed to run "claude" CLI: ${result.error.message}
|
|
1332
|
+
Make sure Claude Code CLI is installed and "claude" is in your PATH.`
|
|
1333
|
+
);
|
|
1334
|
+
}
|
|
1335
|
+
if (result.status !== 0) {
|
|
1336
|
+
throw new Error('"claude mcp add" failed. Check the output above for details.');
|
|
1337
|
+
}
|
|
1338
|
+
console.log("\n\u2713 cortex MCP server registered in Claude Code.");
|
|
1339
|
+
console.log("Restart Claude Code (or open a new session) to activate it.");
|
|
1340
|
+
console.log("\nTo verify: claude mcp list");
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1305
1343
|
// src/cli.ts
|
|
1306
1344
|
var require2 = createRequire(import.meta.url);
|
|
1307
1345
|
var { version } = require2("../package.json");
|
|
@@ -1320,4 +1358,5 @@ program.command("convert <skill-file>").description("Convert a Claude Code skill
|
|
|
1320
1358
|
return convertCommand(skillFile, { to: opts.to, outputDir: opts.outputDir });
|
|
1321
1359
|
});
|
|
1322
1360
|
program.command("mcp").description("Start the MCP server (for use with claude mcp add cortex -- cortex mcp)").action(mcpCommand);
|
|
1361
|
+
program.command("setup-mcp").description("Register cortex as a Claude Code MCP server automatically").action(setupMcpCommand);
|
|
1323
1362
|
await program.parseAsync(process.argv);
|