@hiveai/cli 0.8.0 → 0.9.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/dist/index.js +90 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1035,6 +1035,13 @@ var HAIVE_MCP_ENTRY = {
|
|
|
1035
1035
|
command: "haive-mcp",
|
|
1036
1036
|
args: []
|
|
1037
1037
|
};
|
|
1038
|
+
function projectMcpEntry(root) {
|
|
1039
|
+
return {
|
|
1040
|
+
command: "haive-mcp",
|
|
1041
|
+
args: [],
|
|
1042
|
+
env: { HAIVE_PROJECT_ROOT: root }
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1038
1045
|
function cursorMcpPath() {
|
|
1039
1046
|
return path5.join(HOME, ".cursor", "mcp.json");
|
|
1040
1047
|
}
|
|
@@ -1153,6 +1160,61 @@ async function autoConfigureMcpClients() {
|
|
|
1153
1160
|
}
|
|
1154
1161
|
return results;
|
|
1155
1162
|
}
|
|
1163
|
+
async function configureProjectMcpClients(root) {
|
|
1164
|
+
const entry = projectMcpEntry(root);
|
|
1165
|
+
const results = [];
|
|
1166
|
+
try {
|
|
1167
|
+
const cursorPath = path5.join(root, ".cursor", "mcp.json");
|
|
1168
|
+
let config = {};
|
|
1169
|
+
if (existsSync4(cursorPath)) {
|
|
1170
|
+
try {
|
|
1171
|
+
config = JSON.parse(await readFile3(cursorPath, "utf8"));
|
|
1172
|
+
} catch {
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
config.mcpServers ??= {};
|
|
1176
|
+
config.mcpServers["haive"] = entry;
|
|
1177
|
+
await mkdir(path5.dirname(cursorPath), { recursive: true });
|
|
1178
|
+
await writeFile(cursorPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
1179
|
+
results.push({ client: "Cursor (project)", status: "configured", path: cursorPath });
|
|
1180
|
+
} catch (err) {
|
|
1181
|
+
results.push({ client: "Cursor (project)", status: "error", error: String(err) });
|
|
1182
|
+
}
|
|
1183
|
+
try {
|
|
1184
|
+
const vscodePath = path5.join(root, ".vscode", "mcp.json");
|
|
1185
|
+
let config = {};
|
|
1186
|
+
if (existsSync4(vscodePath)) {
|
|
1187
|
+
try {
|
|
1188
|
+
config = JSON.parse(await readFile3(vscodePath, "utf8"));
|
|
1189
|
+
} catch {
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
config.servers ??= {};
|
|
1193
|
+
config.servers["haive"] = { ...entry, type: "stdio" };
|
|
1194
|
+
await mkdir(path5.dirname(vscodePath), { recursive: true });
|
|
1195
|
+
await writeFile(vscodePath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
1196
|
+
results.push({ client: "VS Code (workspace)", status: "configured", path: vscodePath });
|
|
1197
|
+
} catch (err) {
|
|
1198
|
+
results.push({ client: "VS Code (workspace)", status: "error", error: String(err) });
|
|
1199
|
+
}
|
|
1200
|
+
try {
|
|
1201
|
+
const mcpPath = path5.join(root, ".mcp.json");
|
|
1202
|
+
let config = {};
|
|
1203
|
+
if (existsSync4(mcpPath)) {
|
|
1204
|
+
try {
|
|
1205
|
+
config = JSON.parse(await readFile3(mcpPath, "utf8"));
|
|
1206
|
+
} catch {
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
config.mcpServers ??= {};
|
|
1210
|
+
config.mcpServers["haive"] = { ...entry, type: "stdio" };
|
|
1211
|
+
await writeFile(mcpPath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
1212
|
+
results.push({ client: "Claude Code (project)", status: "configured", path: mcpPath });
|
|
1213
|
+
} catch (err) {
|
|
1214
|
+
results.push({ client: "Claude Code (project)", status: "error", error: String(err) });
|
|
1215
|
+
}
|
|
1216
|
+
return results;
|
|
1217
|
+
}
|
|
1156
1218
|
|
|
1157
1219
|
// src/commands/init-stack-packs.ts
|
|
1158
1220
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "fs/promises";
|
|
@@ -2073,7 +2135,18 @@ function registerInit(program2) {
|
|
|
2073
2135
|
"No supported AI client detected (Cursor, VS Code, Claude Code, Windsurf).\n Configure manually: add haive-mcp to your client's MCP config.\n See: https://github.com/Doucs91/hAIve#mcp-setup"
|
|
2074
2136
|
);
|
|
2075
2137
|
}
|
|
2076
|
-
|
|
2138
|
+
const projectMcpResults = await configureProjectMcpClients(root);
|
|
2139
|
+
for (const r of projectMcpResults) {
|
|
2140
|
+
if (r.status === "configured") {
|
|
2141
|
+
ui.success(`haive-mcp project config written (${path7.relative(root, r.path)})`);
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
await ensureGitignoreEntries(root, [
|
|
2145
|
+
".cursor/mcp.json",
|
|
2146
|
+
".vscode/mcp.json",
|
|
2147
|
+
".mcp.json"
|
|
2148
|
+
]);
|
|
2149
|
+
if (configured.length > 0 || projectMcpResults.some((r) => r.status === "configured")) {
|
|
2077
2150
|
ui.info(
|
|
2078
2151
|
ui.dim(" \u2192 Restart your AI client for MCP changes to take effect.")
|
|
2079
2152
|
);
|
|
@@ -2148,6 +2221,21 @@ async function writeBridge(root, relPath) {
|
|
|
2148
2221
|
await writeFile3(target, BRIDGE_BODY, "utf8");
|
|
2149
2222
|
ui.success(`Created bridge ${relPath}`);
|
|
2150
2223
|
}
|
|
2224
|
+
async function ensureGitignoreEntries(root, patterns) {
|
|
2225
|
+
try {
|
|
2226
|
+
const gitignorePath = path7.join(root, ".gitignore");
|
|
2227
|
+
let existing = "";
|
|
2228
|
+
if (existsSync6(gitignorePath)) {
|
|
2229
|
+
existing = await readFile4(gitignorePath, "utf8");
|
|
2230
|
+
}
|
|
2231
|
+
const lines = existing.split("\n");
|
|
2232
|
+
const missing = patterns.filter((p) => !lines.some((l) => l.trim() === p));
|
|
2233
|
+
if (missing.length === 0) return;
|
|
2234
|
+
const toAppend = (existing.endsWith("\n") || existing === "" ? "" : "\n") + "# hAIve project-level MCP configs (machine-specific absolute paths)\n" + missing.join("\n") + "\n";
|
|
2235
|
+
await writeFile3(gitignorePath, existing + toAppend, "utf8");
|
|
2236
|
+
} catch {
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2151
2239
|
|
|
2152
2240
|
// src/commands/install-hooks.ts
|
|
2153
2241
|
import { mkdir as mkdir5, writeFile as writeFile5, chmod, readFile as readFile6 } from "fs/promises";
|
|
@@ -6203,7 +6291,7 @@ function runCommand(cmd, args, cwd) {
|
|
|
6203
6291
|
|
|
6204
6292
|
// src/index.ts
|
|
6205
6293
|
var program = new Command40();
|
|
6206
|
-
program.name("haive").description("hAIve \u2014 team-first persistent memory layer for AI coding agents").version("0.
|
|
6294
|
+
program.name("haive").description("hAIve \u2014 team-first persistent memory layer for AI coding agents").version("0.9.0");
|
|
6207
6295
|
registerInit(program);
|
|
6208
6296
|
registerMcp(program);
|
|
6209
6297
|
registerBriefing(program);
|