@jive-ai/cli 0.0.9 → 0.0.11
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.mjs +65 -68
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -34,13 +34,20 @@ async function ensureDir(filePath) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
async function getCredentials() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
const fileCredentials = await (async () => {
|
|
38
|
+
try {
|
|
39
|
+
const data = await fs.readFile(CREDENTIALS_PATH, "utf-8");
|
|
40
|
+
return JSON.parse(data);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (error.code === "ENOENT") return null;
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
})();
|
|
46
|
+
if (fileCredentials) return {
|
|
47
|
+
...fileCredentials,
|
|
48
|
+
...process.env.JIVE_API_KEY ? { token: process.env.JIVE_API_KEY } : {}
|
|
49
|
+
};
|
|
50
|
+
return null;
|
|
44
51
|
}
|
|
45
52
|
async function saveCredentials(credentials) {
|
|
46
53
|
await ensureDir(CREDENTIALS_PATH);
|
|
@@ -98,13 +105,17 @@ async function isProjectInitialized() {
|
|
|
98
105
|
return await getProjectConfig() !== null;
|
|
99
106
|
}
|
|
100
107
|
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/constants.ts
|
|
110
|
+
const API_URL = process.env.JIVE_API_URL || "https://next.getjive.app";
|
|
111
|
+
|
|
101
112
|
//#endregion
|
|
102
113
|
//#region src/lib/api-client.ts
|
|
103
114
|
var ApiClient = class {
|
|
104
115
|
client;
|
|
105
116
|
baseURL;
|
|
106
|
-
constructor(baseURL) {
|
|
107
|
-
this.baseURL = baseURL
|
|
117
|
+
constructor(baseURL = API_URL) {
|
|
118
|
+
this.baseURL = baseURL;
|
|
108
119
|
this.client = axios.create({
|
|
109
120
|
baseURL: this.baseURL,
|
|
110
121
|
timeout: 3e4,
|
|
@@ -610,8 +621,7 @@ async function initCommand() {
|
|
|
610
621
|
await requireAuth();
|
|
611
622
|
let teamId;
|
|
612
623
|
const apiClient$1 = getApiClient();
|
|
613
|
-
|
|
614
|
-
if (!credentials) {
|
|
624
|
+
if (!await getCredentials()) {
|
|
615
625
|
console.error(chalk.red("Not authenticated"));
|
|
616
626
|
process.exit(1);
|
|
617
627
|
}
|
|
@@ -708,13 +718,7 @@ async function initCommand() {
|
|
|
708
718
|
}
|
|
709
719
|
}
|
|
710
720
|
spinner.text = "Adding Jive server to .mcp.json...";
|
|
711
|
-
await addMcpServer("jive-mcp", {
|
|
712
|
-
command: "jive mcp start",
|
|
713
|
-
env: {
|
|
714
|
-
JIVE_TEAM_ID: teamId,
|
|
715
|
-
JIVE_AUTH_TOKEN: credentials.token
|
|
716
|
-
}
|
|
717
|
-
});
|
|
721
|
+
await addMcpServer("jive-mcp", { command: "jive mcp start" });
|
|
718
722
|
spinner.text = "Removing uploaded MCP servers from local .mcp.json...";
|
|
719
723
|
if (mcpConfig?.mcpServers) {
|
|
720
724
|
const serversToRemove = [...uploadedServers.map((server) => server.name), ...skippedServers.map((server) => server.name)];
|
|
@@ -773,47 +777,42 @@ async function detachCommand() {
|
|
|
773
777
|
const projectConfig = await getProjectConfig();
|
|
774
778
|
await requireAuth();
|
|
775
779
|
const apiClient$1 = getApiClient();
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
spinner.text = "Pulling MCP servers from platform...";
|
|
793
|
-
try {
|
|
794
|
-
const servers = await apiClient$1.getMcpServers(teamId);
|
|
795
|
-
for (const server of servers) {
|
|
796
|
-
if (server.name === "jive-mcp") continue;
|
|
797
|
-
await addMcpServer(server.name, server.config);
|
|
798
|
-
pulledMcpServers++;
|
|
799
|
-
}
|
|
800
|
-
} catch (error) {
|
|
801
|
-
console.warn(chalk.yellow(`\n⚠️ Could not pull MCP servers: ${error.message}`));
|
|
780
|
+
const teamId = projectConfig?.activeTeamId || projectConfig?.teamId;
|
|
781
|
+
if (!teamId) {
|
|
782
|
+
console.error(chalk.red("No team ID found, select one with `jive team switch`"));
|
|
783
|
+
process.exit(1);
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
spinner.text = "Pulling subagents from platform...";
|
|
787
|
+
try {
|
|
788
|
+
const subagents$1 = await apiClient$1.getSubagents(teamId);
|
|
789
|
+
for (const subagent of subagents$1) {
|
|
790
|
+
await saveSubagentFile({
|
|
791
|
+
name: subagent.name,
|
|
792
|
+
description: subagent.description,
|
|
793
|
+
prompt: subagent.prompt
|
|
794
|
+
});
|
|
795
|
+
pulledSubagents++;
|
|
802
796
|
}
|
|
797
|
+
} catch (error) {
|
|
798
|
+
console.warn(chalk.yellow(`\n⚠️ Could not pull subagents: ${error.message}`));
|
|
803
799
|
}
|
|
804
|
-
spinner.text = "
|
|
805
|
-
if ((await getMcpConfig())?.mcpServers?.["jive-mcp"]) await removeMcpServer("jive-mcp");
|
|
806
|
-
spinner.text = "Removing telemetry plugin...";
|
|
807
|
-
const pluginPath = path.join(process.cwd(), ".claude", "plugins", "jive-mcp-telemetry");
|
|
800
|
+
spinner.text = "Pulling MCP servers from platform...";
|
|
808
801
|
try {
|
|
809
|
-
await
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
802
|
+
const servers$1 = await apiClient$1.getMcpServers(teamId);
|
|
803
|
+
for (const server of servers$1) {
|
|
804
|
+
if (server.name === "jive-mcp") continue;
|
|
805
|
+
await addMcpServer(server.name, server.config);
|
|
806
|
+
pulledMcpServers++;
|
|
807
|
+
}
|
|
814
808
|
} catch (error) {
|
|
815
|
-
|
|
809
|
+
console.warn(chalk.yellow(`\n⚠️ Could not pull MCP servers: ${error.message}`));
|
|
816
810
|
}
|
|
811
|
+
spinner.text = "Removing Jive server from .mcp.json...";
|
|
812
|
+
if ((await getMcpConfig())?.mcpServers?.["jive-mcp"]) await removeMcpServer("jive-mcp");
|
|
813
|
+
spinner.text = "Restoring MCP server config...";
|
|
814
|
+
const servers = await apiClient$1.getMcpServers(teamId);
|
|
815
|
+
for (const server of servers) await addMcpServer(server.name, server.config);
|
|
817
816
|
spinner.text = "Removing subagent-runner...";
|
|
818
817
|
const runnerPath = path.join(process.cwd(), ".claude", "agents", "subagent-runner.md");
|
|
819
818
|
try {
|
|
@@ -835,11 +834,7 @@ async function detachCommand() {
|
|
|
835
834
|
const gitignorePath = path.join(process.cwd(), ".gitignore");
|
|
836
835
|
try {
|
|
837
836
|
let content = await fs.readFile(gitignorePath, "utf-8");
|
|
838
|
-
const linesToRemove = [
|
|
839
|
-
".jive/config.json",
|
|
840
|
-
".jive/sync.json",
|
|
841
|
-
".claude/plugins/"
|
|
842
|
-
];
|
|
837
|
+
const linesToRemove = [".jive"];
|
|
843
838
|
const lines = content.split("\n");
|
|
844
839
|
const filteredLines = lines.filter((line) => !linesToRemove.includes(line.trim()));
|
|
845
840
|
if (filteredLines.length !== lines.length) await fs.writeFile(gitignorePath, filteredLines.join("\n"));
|
|
@@ -851,7 +846,7 @@ async function detachCommand() {
|
|
|
851
846
|
if (pulledSubagents > 0) console.log(chalk.green(` ✓ Pulled ${pulledSubagents} subagent(s) from platform`));
|
|
852
847
|
if (pulledMcpServers > 0) console.log(chalk.green(` ✓ Pulled ${pulledMcpServers} MCP server(s) from platform`));
|
|
853
848
|
console.log(chalk.green(" ✓ Removed Jive server from .mcp.json"));
|
|
854
|
-
console.log(chalk.green(" ✓
|
|
849
|
+
console.log(chalk.green(" ✓ Restored MCP server config"));
|
|
855
850
|
console.log(chalk.green(" ✓ Removed subagent-runner"));
|
|
856
851
|
console.log(chalk.green(" ✓ Removed .jive directory"));
|
|
857
852
|
console.log(chalk.green(" ✓ Cleaned up .gitignore"));
|
|
@@ -1349,17 +1344,19 @@ function log(...args) {
|
|
|
1349
1344
|
*/
|
|
1350
1345
|
async function startMcpServer() {
|
|
1351
1346
|
log("=== Jive Server Starting ===");
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
log("Error: JIVE_API_KEY environment variable is required");
|
|
1356
|
-
log("Usage: JIVE_API_KEY=jive_xxx npm run mcp");
|
|
1347
|
+
const projectConfig = await getProjectConfig();
|
|
1348
|
+
if (!(projectConfig?.activeTeamId || projectConfig?.teamId)) {
|
|
1349
|
+
log("Error: No team ID found, select one with `jive team switch`");
|
|
1357
1350
|
process.exit(1);
|
|
1351
|
+
return;
|
|
1358
1352
|
}
|
|
1359
|
-
|
|
1360
|
-
|
|
1353
|
+
const apiKey = (await getCredentials())?.token;
|
|
1354
|
+
if (!apiKey) {
|
|
1355
|
+
log("Error: No API key found, please login with `jive login`");
|
|
1361
1356
|
process.exit(1);
|
|
1357
|
+
return;
|
|
1362
1358
|
}
|
|
1359
|
+
const apiUrl = API_URL;
|
|
1363
1360
|
log(`Jive server connecting to ${apiUrl}`);
|
|
1364
1361
|
const connectionManager = new McpConnectionManager();
|
|
1365
1362
|
try {
|
|
@@ -2067,7 +2064,7 @@ async function checkTeamMembership() {
|
|
|
2067
2064
|
|
|
2068
2065
|
//#endregion
|
|
2069
2066
|
//#region package.json
|
|
2070
|
-
var version = "0.0.
|
|
2067
|
+
var version = "0.0.11";
|
|
2071
2068
|
|
|
2072
2069
|
//#endregion
|
|
2073
2070
|
//#region src/index.ts
|