@agentvalet/register 0.4.20 → 0.5.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 +206 -109
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1131,45 +1131,114 @@ env = { AGENT_ID = "${params.agentId}", OWNER_ID = "${params.ownerId}", PROXY_UR
|
|
|
1131
1131
|
}
|
|
1132
1132
|
return written;
|
|
1133
1133
|
}
|
|
1134
|
+
async function stripAgentvaletFromMcpJson(filePath) {
|
|
1135
|
+
if (!existsSync5(filePath)) return false;
|
|
1136
|
+
try {
|
|
1137
|
+
const text = await readFile2(filePath, "utf8");
|
|
1138
|
+
const config = JSON.parse(text);
|
|
1139
|
+
const servers = config.mcpServers ?? {};
|
|
1140
|
+
if (!servers.agentvalet) return false;
|
|
1141
|
+
delete servers.agentvalet;
|
|
1142
|
+
config.mcpServers = servers;
|
|
1143
|
+
await writeFile4(filePath, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
1144
|
+
return true;
|
|
1145
|
+
} catch {
|
|
1146
|
+
return false;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
async function cleanProjectScopedEntries() {
|
|
1150
|
+
const cleaned = [];
|
|
1151
|
+
const cwd = process.cwd();
|
|
1152
|
+
if (await stripAgentvaletFromMcpJson(path4.join(cwd, ".mcp.json"))) {
|
|
1153
|
+
cleaned.push(".mcp.json (project entry removed)");
|
|
1154
|
+
}
|
|
1155
|
+
if (await stripAgentvaletFromMcpJson(path4.join(cwd, ".cursor/mcp.json"))) {
|
|
1156
|
+
cleaned.push(".cursor/mcp.json (project entry removed)");
|
|
1157
|
+
}
|
|
1158
|
+
const factoryProjectMcp = path4.join(cwd, ".factory/mcp.json");
|
|
1159
|
+
if (existsSync5(factoryProjectMcp)) {
|
|
1160
|
+
try {
|
|
1161
|
+
const text = await readFile2(factoryProjectMcp, "utf8");
|
|
1162
|
+
const config = JSON.parse(text);
|
|
1163
|
+
if (config.agentvalet) {
|
|
1164
|
+
delete config.agentvalet;
|
|
1165
|
+
await writeFile4(factoryProjectMcp, JSON.stringify(config, null, 2) + "\n", "utf8");
|
|
1166
|
+
cleaned.push(".factory/mcp.json (project entry removed)");
|
|
1167
|
+
}
|
|
1168
|
+
} catch {
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
return cleaned;
|
|
1172
|
+
}
|
|
1134
1173
|
async function writeIdeConfigs(params) {
|
|
1135
|
-
const { detected, ...mcpParams } = params;
|
|
1174
|
+
const { detected, scope = "user", ...mcpParams } = params;
|
|
1136
1175
|
const cwd = process.cwd();
|
|
1176
|
+
const home = os.homedir();
|
|
1137
1177
|
const written = [];
|
|
1138
1178
|
const entry = buildMcpEntry(mcpParams);
|
|
1139
|
-
if (
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1179
|
+
if (scope === "user") {
|
|
1180
|
+
if (detected.claudeCode) {
|
|
1181
|
+
const claudeUserConfig = path4.join(home, ".claude.json");
|
|
1182
|
+
try {
|
|
1183
|
+
await mergeJsonFile(claudeUserConfig, "agentvalet", entry);
|
|
1184
|
+
written.push("~/.claude.json");
|
|
1185
|
+
} catch (err) {
|
|
1186
|
+
console.warn(` Warning: could not write ~/.claude.json: ${err.message}`);
|
|
1187
|
+
}
|
|
1146
1188
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1189
|
+
if (detected.cursor) {
|
|
1190
|
+
const cursorUserDir = path4.join(home, ".cursor");
|
|
1191
|
+
const cursorUserMcp = path4.join(cursorUserDir, "mcp.json");
|
|
1149
1192
|
try {
|
|
1150
|
-
await
|
|
1151
|
-
|
|
1193
|
+
await mkdir3(cursorUserDir, { recursive: true });
|
|
1194
|
+
await mergeJsonFile(cursorUserMcp, "agentvalet", entry);
|
|
1195
|
+
written.push("~/.cursor/mcp.json");
|
|
1152
1196
|
} catch (err) {
|
|
1153
|
-
console.warn(` Warning: could not write
|
|
1197
|
+
console.warn(` Warning: could not write ~/.cursor/mcp.json: ${err.message}`);
|
|
1154
1198
|
}
|
|
1155
|
-
} else {
|
|
1156
|
-
written.push("CLAUDE.md (already exists \u2014 skipped)");
|
|
1157
1199
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1200
|
+
if (detected.factoryDroid) {
|
|
1201
|
+
const fdResults = await writeFactoryDroidConfig({ ...mcpParams, scope: "user" });
|
|
1202
|
+
written.push(...fdResults);
|
|
1203
|
+
}
|
|
1204
|
+
const cleaned = await cleanProjectScopedEntries();
|
|
1205
|
+
written.push(...cleaned);
|
|
1206
|
+
} else {
|
|
1207
|
+
if (detected.claudeCode) {
|
|
1208
|
+
const claudeMcpPath = path4.join(cwd, ".mcp.json");
|
|
1209
|
+
try {
|
|
1210
|
+
await mergeJsonFile(claudeMcpPath, "agentvalet", entry);
|
|
1211
|
+
written.push(".mcp.json");
|
|
1212
|
+
} catch (err) {
|
|
1213
|
+
console.warn(` Warning: could not write .mcp.json: ${err.message}`);
|
|
1214
|
+
}
|
|
1215
|
+
const claudeMdPath = path4.join(cwd, "CLAUDE.md");
|
|
1216
|
+
if (!existsSync5(claudeMdPath)) {
|
|
1217
|
+
try {
|
|
1218
|
+
await writeFile4(claudeMdPath, buildClaudeMd(params.agentId, params.ownerId, params.proxyUrl), "utf8");
|
|
1219
|
+
written.push("CLAUDE.md");
|
|
1220
|
+
} catch (err) {
|
|
1221
|
+
console.warn(` Warning: could not write CLAUDE.md: ${err.message}`);
|
|
1222
|
+
}
|
|
1223
|
+
} else {
|
|
1224
|
+
written.push("CLAUDE.md (already exists \u2014 skipped)");
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
if (detected.cursor) {
|
|
1228
|
+
const cursorDir = path4.join(cwd, ".cursor");
|
|
1229
|
+
const cursorMcpPath = path4.join(cursorDir, "mcp.json");
|
|
1230
|
+
try {
|
|
1231
|
+
await mkdir3(cursorDir, { recursive: true });
|
|
1232
|
+
await mergeJsonFile(cursorMcpPath, "agentvalet", entry);
|
|
1233
|
+
written.push(".cursor/mcp.json");
|
|
1234
|
+
} catch (err) {
|
|
1235
|
+
console.warn(` Warning: could not write .cursor/mcp.json: ${err.message}`);
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
if (detected.factoryDroid) {
|
|
1239
|
+
const fdResults = await writeFactoryDroidConfig({ ...mcpParams, scope: "project" });
|
|
1240
|
+
written.push(...fdResults);
|
|
1168
1241
|
}
|
|
1169
|
-
}
|
|
1170
|
-
if (detected.factoryDroid) {
|
|
1171
|
-
const fdResults = await writeFactoryDroidConfig(mcpParams);
|
|
1172
|
-
written.push(...fdResults);
|
|
1173
1242
|
}
|
|
1174
1243
|
return written;
|
|
1175
1244
|
}
|
|
@@ -1207,27 +1276,25 @@ async function writeFactoryDroidConfig(params) {
|
|
|
1207
1276
|
const home = os.homedir();
|
|
1208
1277
|
const written = [];
|
|
1209
1278
|
const entry = buildMcpEntry(params);
|
|
1279
|
+
const scope = params.scope ?? "user";
|
|
1210
1280
|
const globalDir = path4.join(home, ".factory");
|
|
1211
1281
|
const projectDir = path4.join(process.cwd(), ".factory");
|
|
1212
|
-
|
|
1213
|
-
const projectDirExists = existsSync5(projectDir);
|
|
1214
|
-
if (globalDirExists) {
|
|
1282
|
+
if (scope === "user") {
|
|
1215
1283
|
try {
|
|
1284
|
+
await mkdir3(globalDir, { recursive: true });
|
|
1216
1285
|
await mergeFactoryDroidMcpJson(path4.join(globalDir, "mcp.json"), "agentvalet", entry);
|
|
1217
1286
|
written.push("~/.factory/mcp.json");
|
|
1218
1287
|
} catch (err) {
|
|
1219
1288
|
console.warn(` Warning: could not write ~/.factory/mcp.json: ${err.message}`);
|
|
1220
1289
|
}
|
|
1221
|
-
}
|
|
1222
|
-
if (projectDirExists && !globalDirExists) {
|
|
1290
|
+
} else {
|
|
1223
1291
|
try {
|
|
1292
|
+
await mkdir3(projectDir, { recursive: true });
|
|
1224
1293
|
await mergeFactoryDroidMcpJson(path4.join(projectDir, "mcp.json"), "agentvalet", entry);
|
|
1225
1294
|
written.push(".factory/mcp.json");
|
|
1226
1295
|
} catch (err) {
|
|
1227
1296
|
console.warn(` Warning: could not write .factory/mcp.json: ${err.message}`);
|
|
1228
1297
|
}
|
|
1229
|
-
}
|
|
1230
|
-
if (written.length > 0) {
|
|
1231
1298
|
try {
|
|
1232
1299
|
await updateGitignoreForFactoryDroid();
|
|
1233
1300
|
} catch {
|
|
@@ -1315,7 +1382,8 @@ async function frameworkSetupConsent(detected) {
|
|
|
1315
1382
|
import os3 from "os";
|
|
1316
1383
|
import path6 from "path";
|
|
1317
1384
|
import { writeFile as writeFile5 } from "fs/promises";
|
|
1318
|
-
async function runOnboard() {
|
|
1385
|
+
async function runOnboard(opts = {}) {
|
|
1386
|
+
const scope = opts.scope ?? "user";
|
|
1319
1387
|
console.log("");
|
|
1320
1388
|
console.log(chalk7.bold(" AgentValet \u2014 Agent Registration"));
|
|
1321
1389
|
console.log(chalk7.dim(" app.agentvalet.ai"));
|
|
@@ -1347,7 +1415,7 @@ async function runOnboard() {
|
|
|
1347
1415
|
console.log(chalk7.dim(" Signed out. Run again to re-authenticate."));
|
|
1348
1416
|
return;
|
|
1349
1417
|
}
|
|
1350
|
-
await registerAgentFlow(stored.cliToken, stored.ownerId);
|
|
1418
|
+
await registerAgentFlow(stored.cliToken, stored.ownerId, scope);
|
|
1351
1419
|
return;
|
|
1352
1420
|
}
|
|
1353
1421
|
const { authMethod } = await prompts3({
|
|
@@ -1364,7 +1432,7 @@ async function runOnboard() {
|
|
|
1364
1432
|
process.exit(0);
|
|
1365
1433
|
}
|
|
1366
1434
|
if (authMethod === "ownerid") {
|
|
1367
|
-
await ownerIdFlow();
|
|
1435
|
+
await ownerIdFlow(scope);
|
|
1368
1436
|
return;
|
|
1369
1437
|
}
|
|
1370
1438
|
let credentials;
|
|
@@ -1384,9 +1452,9 @@ async function runOnboard() {
|
|
|
1384
1452
|
email: credentials.email ?? "",
|
|
1385
1453
|
cliToken: credentials.cliToken
|
|
1386
1454
|
});
|
|
1387
|
-
await registerAgentFlow(credentials.cliToken, credentials.ownerId);
|
|
1455
|
+
await registerAgentFlow(credentials.cliToken, credentials.ownerId, scope);
|
|
1388
1456
|
}
|
|
1389
|
-
async function ownerIdFlow() {
|
|
1457
|
+
async function ownerIdFlow(scope) {
|
|
1390
1458
|
console.log("");
|
|
1391
1459
|
console.log(chalk7.dim(" Find your Owner ID at: ") + chalk7.cyan.underline("https://app.agentvalet.ai/settings"));
|
|
1392
1460
|
console.log("");
|
|
@@ -1417,9 +1485,9 @@ async function ownerIdFlow() {
|
|
|
1417
1485
|
email: account.email ?? "",
|
|
1418
1486
|
cliToken: account.cli_token
|
|
1419
1487
|
});
|
|
1420
|
-
await registerAgentFlow(account.cli_token, account.owner_id);
|
|
1488
|
+
await registerAgentFlow(account.cli_token, account.owner_id, scope);
|
|
1421
1489
|
}
|
|
1422
|
-
async function registerAgentFlow(apiKey, ownerId) {
|
|
1490
|
+
async function registerAgentFlow(apiKey, ownerId, scope = "user") {
|
|
1423
1491
|
const hostname = os3.hostname().split(".")[0];
|
|
1424
1492
|
const dirName = process.cwd().split("/").pop() ?? process.cwd().split("\\").pop() ?? "agent";
|
|
1425
1493
|
const { agentName } = await prompts3({
|
|
@@ -1492,7 +1560,8 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1492
1560
|
ownerId,
|
|
1493
1561
|
proxyUrl,
|
|
1494
1562
|
keyPath,
|
|
1495
|
-
detected
|
|
1563
|
+
detected,
|
|
1564
|
+
scope
|
|
1496
1565
|
});
|
|
1497
1566
|
for (const r of ideResults) {
|
|
1498
1567
|
console.log(chalk7.green(` \u2713 ${r}`));
|
|
@@ -1506,26 +1575,22 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1506
1575
|
for (const r of globalResults) {
|
|
1507
1576
|
console.log(chalk7.green(` \u2713 ${r}`));
|
|
1508
1577
|
}
|
|
1509
|
-
if (
|
|
1510
|
-
writeAgentsMd();
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
writeFactoryDroidDroid();
|
|
1517
|
-
writeFactoryDroidCommand();
|
|
1518
|
-
if (installReliabilityDroid) {
|
|
1519
|
-
writeFactoryDroidReliabilityDroid();
|
|
1578
|
+
if (scope === "project") {
|
|
1579
|
+
if (detected.codex) writeAgentsMd();
|
|
1580
|
+
if (detected.openclaw) writeSkillMd();
|
|
1581
|
+
if (detected.factoryDroid) {
|
|
1582
|
+
writeFactoryDroidDroid();
|
|
1583
|
+
writeFactoryDroidCommand();
|
|
1584
|
+
if (installReliabilityDroid) writeFactoryDroidReliabilityDroid();
|
|
1520
1585
|
}
|
|
1586
|
+
writeQuickstartDoc({
|
|
1587
|
+
agentId: agent.agent_id,
|
|
1588
|
+
ownerId,
|
|
1589
|
+
proxyUrl,
|
|
1590
|
+
keyPath,
|
|
1591
|
+
detected
|
|
1592
|
+
});
|
|
1521
1593
|
}
|
|
1522
|
-
writeQuickstartDoc({
|
|
1523
|
-
agentId: agent.agent_id,
|
|
1524
|
-
ownerId,
|
|
1525
|
-
proxyUrl,
|
|
1526
|
-
keyPath,
|
|
1527
|
-
detected
|
|
1528
|
-
});
|
|
1529
1594
|
ensureMcpServer();
|
|
1530
1595
|
} else if (shouldSetup === false) {
|
|
1531
1596
|
console.log("");
|
|
@@ -1553,22 +1618,35 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1553
1618
|
console.log(chalk7.dim(" Approve this agent in your dashboard to activate it."));
|
|
1554
1619
|
console.log("");
|
|
1555
1620
|
if (shouldSetup) {
|
|
1556
|
-
if (
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1621
|
+
if (scope === "user") {
|
|
1622
|
+
const restartList = [];
|
|
1623
|
+
if (detected.claudeCode) restartList.push("Claude Code");
|
|
1624
|
+
if (detected.cursor) restartList.push("Cursor");
|
|
1625
|
+
if (detected.factoryDroid) restartList.push("Factory Droid");
|
|
1626
|
+
if (detected.codex) restartList.push("Codex CLI");
|
|
1627
|
+
if (restartList.length > 0) {
|
|
1628
|
+
console.log(chalk7.dim(" Restart these to pick up the new MCP server (no trust prompt \u2014 user-scoped):"));
|
|
1629
|
+
for (const r of restartList) console.log(chalk7.dim(` ${r}`));
|
|
1630
|
+
console.log("");
|
|
1631
|
+
}
|
|
1632
|
+
} else {
|
|
1633
|
+
if (detected.claudeCode) {
|
|
1634
|
+
console.log(chalk7.yellow(" \u26A0 Claude Code: project MCPs require trust on first run."));
|
|
1635
|
+
console.log(chalk7.dim(" In your Claude Code session, run: /mcp"));
|
|
1636
|
+
console.log(chalk7.dim(' Approve "agentvalet" to load the tools.'));
|
|
1637
|
+
console.log("");
|
|
1638
|
+
}
|
|
1639
|
+
if (detected.cursor) {
|
|
1640
|
+
console.log(chalk7.dim(" Cursor: restart Cursor (or reopen the workspace) to pick up the MCP."));
|
|
1641
|
+
}
|
|
1642
|
+
if (detected.factoryDroid) {
|
|
1643
|
+
console.log(chalk7.dim(" Factory Droid: restart Factory to pick up the MCP."));
|
|
1644
|
+
}
|
|
1645
|
+
if (detected.codex) {
|
|
1646
|
+
console.log(chalk7.dim(" Codex CLI: start a new codex session to pick up the MCP."));
|
|
1647
|
+
}
|
|
1560
1648
|
console.log("");
|
|
1561
1649
|
}
|
|
1562
|
-
if (detected.cursor) {
|
|
1563
|
-
console.log(chalk7.dim(" Cursor: restart Cursor (or reopen the workspace) to pick up the MCP."));
|
|
1564
|
-
}
|
|
1565
|
-
if (detected.factoryDroid) {
|
|
1566
|
-
console.log(chalk7.dim(" Factory Droid: restart Factory to pick up the MCP."));
|
|
1567
|
-
}
|
|
1568
|
-
if (detected.codex) {
|
|
1569
|
-
console.log(chalk7.dim(" Codex CLI: start a new codex session to pick up the MCP."));
|
|
1570
|
-
}
|
|
1571
|
-
console.log("");
|
|
1572
1650
|
}
|
|
1573
1651
|
console.log(" Useful commands:");
|
|
1574
1652
|
console.log(chalk7.dim(" npx @agentvalet/register \u2014 register another agent"));
|
|
@@ -1900,8 +1978,10 @@ function cleanLocally() {
|
|
|
1900
1978
|
if (stripMcpJson(resolve3(".mcp.json"))) stripped.push(".mcp.json");
|
|
1901
1979
|
if (stripMcpJson(resolve3(".cursor/mcp.json"))) stripped.push(".cursor/mcp.json");
|
|
1902
1980
|
if (stripMcpJson(resolve3(".factory/mcp.json"), { wrapped: false })) stripped.push(".factory/mcp.json");
|
|
1903
|
-
const
|
|
1904
|
-
if (stripMcpJson(
|
|
1981
|
+
const home = homedir2();
|
|
1982
|
+
if (stripMcpJson(join2(home, ".claude.json"))) stripped.push("~/.claude.json");
|
|
1983
|
+
if (stripMcpJson(join2(home, ".cursor", "mcp.json"))) stripped.push("~/.cursor/mcp.json");
|
|
1984
|
+
if (stripMcpJson(join2(home, ".factory", "mcp.json"), { wrapped: false })) stripped.push("~/.factory/mcp.json");
|
|
1905
1985
|
if (stripCodexToml()) stripped.push("~/.codex/config.toml");
|
|
1906
1986
|
stripClaudeMd();
|
|
1907
1987
|
stripSettingsJson();
|
|
@@ -2090,7 +2170,8 @@ async function claimToken(installToken) {
|
|
|
2090
2170
|
return body;
|
|
2091
2171
|
}
|
|
2092
2172
|
function installCommand() {
|
|
2093
|
-
return new Command5("install").description("Claim an agent created in the dashboard using a one-time install token").argument("<token>", "install token (itok_...) from the dashboard").option("--no-frameworks", "skip IDE/framework configuration prompts").action(async (token, opts) => {
|
|
2173
|
+
return new Command5("install").description("Claim an agent created in the dashboard using a one-time install token").argument("<token>", "install token (itok_...) from the dashboard").option("--no-frameworks", "skip IDE/framework configuration prompts").option("--project", "write project-scoped configs (.mcp.json, .cursor/mcp.json) instead of user-scoped (~/.claude.json, ~/.cursor/mcp.json)").action(async (token, opts) => {
|
|
2174
|
+
const scope = opts.project ? "project" : "user";
|
|
2094
2175
|
if (!token.startsWith("itok_")) {
|
|
2095
2176
|
console.error(chalk12.red('Invalid install token. Tokens start with "itok_".'));
|
|
2096
2177
|
process.exit(3);
|
|
@@ -2150,7 +2231,8 @@ function installCommand() {
|
|
|
2150
2231
|
ownerId: owner_id,
|
|
2151
2232
|
proxyUrl: proxy_url,
|
|
2152
2233
|
keyPath: AGENT_KEY_PATH,
|
|
2153
|
-
detected
|
|
2234
|
+
detected,
|
|
2235
|
+
scope
|
|
2154
2236
|
});
|
|
2155
2237
|
for (const r of ideResults) console.log(chalk12.green(` \u2713 ${r}`));
|
|
2156
2238
|
const globalResults = await writeGlobalFrameworkConfigs({
|
|
@@ -2160,20 +2242,22 @@ function installCommand() {
|
|
|
2160
2242
|
keyPath: AGENT_KEY_PATH
|
|
2161
2243
|
});
|
|
2162
2244
|
for (const r of globalResults) console.log(chalk12.green(` \u2713 ${r}`));
|
|
2163
|
-
if (
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2245
|
+
if (scope === "project") {
|
|
2246
|
+
if (detected.codex) writeAgentsMd();
|
|
2247
|
+
if (detected.openclaw) writeSkillMd();
|
|
2248
|
+
if (detected.factoryDroid) {
|
|
2249
|
+
writeFactoryDroidDroid();
|
|
2250
|
+
writeFactoryDroidCommand();
|
|
2251
|
+
if (installReliabilityDroid) writeFactoryDroidReliabilityDroid();
|
|
2252
|
+
}
|
|
2253
|
+
writeQuickstartDoc({
|
|
2254
|
+
agentId: agent_id,
|
|
2255
|
+
ownerId: owner_id,
|
|
2256
|
+
proxyUrl: proxy_url,
|
|
2257
|
+
keyPath: AGENT_KEY_PATH,
|
|
2258
|
+
detected
|
|
2259
|
+
});
|
|
2169
2260
|
}
|
|
2170
|
-
writeQuickstartDoc({
|
|
2171
|
-
agentId: agent_id,
|
|
2172
|
-
ownerId: owner_id,
|
|
2173
|
-
proxyUrl: proxy_url,
|
|
2174
|
-
keyPath: AGENT_KEY_PATH,
|
|
2175
|
-
detected
|
|
2176
|
-
});
|
|
2177
2261
|
ensureMcpServer();
|
|
2178
2262
|
}
|
|
2179
2263
|
}
|
|
@@ -2198,20 +2282,33 @@ function installCommand() {
|
|
|
2198
2282
|
console.log("");
|
|
2199
2283
|
if (opts.frameworks !== false) {
|
|
2200
2284
|
const detected = detectFrameworks();
|
|
2201
|
-
if (
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
}
|
|
2213
|
-
|
|
2214
|
-
|
|
2285
|
+
if (scope === "user") {
|
|
2286
|
+
const restartList = [];
|
|
2287
|
+
if (detected.claudeCode) restartList.push("Claude Code");
|
|
2288
|
+
if (detected.cursor) restartList.push("Cursor");
|
|
2289
|
+
if (detected.factoryDroid) restartList.push("Factory Droid");
|
|
2290
|
+
if (detected.codex) restartList.push("Codex CLI");
|
|
2291
|
+
if (restartList.length > 0) {
|
|
2292
|
+
console.log(chalk12.dim(" Restart these to pick up the new MCP server (no trust prompt \u2014 user-scoped):"));
|
|
2293
|
+
for (const r of restartList) console.log(chalk12.dim(` ${r}`));
|
|
2294
|
+
console.log("");
|
|
2295
|
+
}
|
|
2296
|
+
} else {
|
|
2297
|
+
if (detected.claudeCode) {
|
|
2298
|
+
console.log(chalk12.yellow(" \u26A0 Claude Code: project MCPs require trust on first run."));
|
|
2299
|
+
console.log(chalk12.dim(" In your Claude Code session, run: /mcp"));
|
|
2300
|
+
console.log(chalk12.dim(' Approve "agentvalet" to load the tools.'));
|
|
2301
|
+
console.log("");
|
|
2302
|
+
}
|
|
2303
|
+
if (detected.cursor) {
|
|
2304
|
+
console.log(chalk12.dim(" Cursor: restart Cursor (or reopen the workspace) to pick up the MCP."));
|
|
2305
|
+
}
|
|
2306
|
+
if (detected.factoryDroid) {
|
|
2307
|
+
console.log(chalk12.dim(" Factory Droid: restart Factory to pick up the MCP."));
|
|
2308
|
+
}
|
|
2309
|
+
if (detected.codex) {
|
|
2310
|
+
console.log(chalk12.dim(" Codex CLI: start a new codex session to pick up the MCP."));
|
|
2311
|
+
}
|
|
2215
2312
|
}
|
|
2216
2313
|
}
|
|
2217
2314
|
console.log(` Dashboard: ${chalk12.cyan.underline("https://app.agentvalet.ai/agents/" + agent_id)}`);
|
|
@@ -2227,14 +2324,14 @@ function collectScope(value, previous) {
|
|
|
2227
2324
|
return [...previous, value];
|
|
2228
2325
|
}
|
|
2229
2326
|
var program = new Command6();
|
|
2230
|
-
program.name("agentvalet-register").description("Self-register an AI agent with AgentValet").version(version).option("--owner <uuid>", "Owner ID (or set AGENTVALET_OWNER env var)").option("--name <name>", "Agent name").option("--description <desc>", "Agent description").option("--scope <platform:scope>", "Requested scope, repeatable", collectScope, []).option("--api-url <url>", "AgentValet API base URL", "https://api.agentvalet.ai").option("--json", "Machine-readable JSON output").option("--no-wait", "Register only, do not wait for approval").option("--timeout <seconds>", "Approval wait timeout in seconds", "300").action(async (opts) => {
|
|
2327
|
+
program.name("agentvalet-register").description("Self-register an AI agent with AgentValet").version(version).option("--owner <uuid>", "Owner ID (or set AGENTVALET_OWNER env var)").option("--name <name>", "Agent name").option("--description <desc>", "Agent description").option("--scope <platform:scope>", "Requested scope, repeatable", collectScope, []).option("--api-url <url>", "AgentValet API base URL", "https://api.agentvalet.ai").option("--json", "Machine-readable JSON output").option("--no-wait", "Register only, do not wait for approval").option("--timeout <seconds>", "Approval wait timeout in seconds", "300").option("--project", "Write project-scoped MCP configs (.mcp.json, .cursor/mcp.json) instead of user-scoped (~/.claude.json, ~/.cursor/mcp.json)").action(async (opts) => {
|
|
2231
2328
|
const isJson = !!opts.json;
|
|
2232
2329
|
let ownerId = opts.owner ?? process.env.AGENTVALET_OWNER ?? "";
|
|
2233
2330
|
let agentName = opts.name ?? "";
|
|
2234
2331
|
let description = opts.description ?? "";
|
|
2235
2332
|
let scopes = opts.scope;
|
|
2236
2333
|
if (!ownerId && !isAuthenticated()) {
|
|
2237
|
-
await runOnboard();
|
|
2334
|
+
await runOnboard({ scope: opts.project ? "project" : "user" });
|
|
2238
2335
|
return;
|
|
2239
2336
|
}
|
|
2240
2337
|
if (!agentName) {
|