@jive-ai/cli 0.0.9 → 0.0.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/index.mjs +41 -53
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -98,13 +98,17 @@ async function isProjectInitialized() {
|
|
|
98
98
|
return await getProjectConfig() !== null;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
//#endregion
|
|
102
|
+
//#region src/constants.ts
|
|
103
|
+
const API_URL = process.env.JIVE_API_URL || "https://next.getjive.app";
|
|
104
|
+
|
|
101
105
|
//#endregion
|
|
102
106
|
//#region src/lib/api-client.ts
|
|
103
107
|
var ApiClient = class {
|
|
104
108
|
client;
|
|
105
109
|
baseURL;
|
|
106
|
-
constructor(baseURL) {
|
|
107
|
-
this.baseURL = baseURL
|
|
110
|
+
constructor(baseURL = API_URL) {
|
|
111
|
+
this.baseURL = baseURL;
|
|
108
112
|
this.client = axios.create({
|
|
109
113
|
baseURL: this.baseURL,
|
|
110
114
|
timeout: 3e4,
|
|
@@ -610,8 +614,7 @@ async function initCommand() {
|
|
|
610
614
|
await requireAuth();
|
|
611
615
|
let teamId;
|
|
612
616
|
const apiClient$1 = getApiClient();
|
|
613
|
-
|
|
614
|
-
if (!credentials) {
|
|
617
|
+
if (!await getCredentials()) {
|
|
615
618
|
console.error(chalk.red("Not authenticated"));
|
|
616
619
|
process.exit(1);
|
|
617
620
|
}
|
|
@@ -708,13 +711,7 @@ async function initCommand() {
|
|
|
708
711
|
}
|
|
709
712
|
}
|
|
710
713
|
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
|
-
});
|
|
714
|
+
await addMcpServer("jive-mcp", { command: "jive mcp start" });
|
|
718
715
|
spinner.text = "Removing uploaded MCP servers from local .mcp.json...";
|
|
719
716
|
if (mcpConfig?.mcpServers) {
|
|
720
717
|
const serversToRemove = [...uploadedServers.map((server) => server.name), ...skippedServers.map((server) => server.name)];
|
|
@@ -773,47 +770,42 @@ async function detachCommand() {
|
|
|
773
770
|
const projectConfig = await getProjectConfig();
|
|
774
771
|
await requireAuth();
|
|
775
772
|
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}`));
|
|
773
|
+
const teamId = projectConfig?.activeTeamId || projectConfig?.teamId;
|
|
774
|
+
if (!teamId) {
|
|
775
|
+
console.error(chalk.red("No team ID found, select one with `jive team switch`"));
|
|
776
|
+
process.exit(1);
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
spinner.text = "Pulling subagents from platform...";
|
|
780
|
+
try {
|
|
781
|
+
const subagents$1 = await apiClient$1.getSubagents(teamId);
|
|
782
|
+
for (const subagent of subagents$1) {
|
|
783
|
+
await saveSubagentFile({
|
|
784
|
+
name: subagent.name,
|
|
785
|
+
description: subagent.description,
|
|
786
|
+
prompt: subagent.prompt
|
|
787
|
+
});
|
|
788
|
+
pulledSubagents++;
|
|
802
789
|
}
|
|
790
|
+
} catch (error) {
|
|
791
|
+
console.warn(chalk.yellow(`\n⚠️ Could not pull subagents: ${error.message}`));
|
|
803
792
|
}
|
|
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");
|
|
793
|
+
spinner.text = "Pulling MCP servers from platform...";
|
|
808
794
|
try {
|
|
809
|
-
await
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
795
|
+
const servers$1 = await apiClient$1.getMcpServers(teamId);
|
|
796
|
+
for (const server of servers$1) {
|
|
797
|
+
if (server.name === "jive-mcp") continue;
|
|
798
|
+
await addMcpServer(server.name, server.config);
|
|
799
|
+
pulledMcpServers++;
|
|
800
|
+
}
|
|
814
801
|
} catch (error) {
|
|
815
|
-
|
|
802
|
+
console.warn(chalk.yellow(`\n⚠️ Could not pull MCP servers: ${error.message}`));
|
|
816
803
|
}
|
|
804
|
+
spinner.text = "Removing Jive server from .mcp.json...";
|
|
805
|
+
if ((await getMcpConfig())?.mcpServers?.["jive-mcp"]) await removeMcpServer("jive-mcp");
|
|
806
|
+
spinner.text = "Restoring MCP server config...";
|
|
807
|
+
const servers = await apiClient$1.getMcpServers(teamId);
|
|
808
|
+
for (const server of servers) await addMcpServer(server.name, server.config);
|
|
817
809
|
spinner.text = "Removing subagent-runner...";
|
|
818
810
|
const runnerPath = path.join(process.cwd(), ".claude", "agents", "subagent-runner.md");
|
|
819
811
|
try {
|
|
@@ -835,11 +827,7 @@ async function detachCommand() {
|
|
|
835
827
|
const gitignorePath = path.join(process.cwd(), ".gitignore");
|
|
836
828
|
try {
|
|
837
829
|
let content = await fs.readFile(gitignorePath, "utf-8");
|
|
838
|
-
const linesToRemove = [
|
|
839
|
-
".jive/config.json",
|
|
840
|
-
".jive/sync.json",
|
|
841
|
-
".claude/plugins/"
|
|
842
|
-
];
|
|
830
|
+
const linesToRemove = [".jive"];
|
|
843
831
|
const lines = content.split("\n");
|
|
844
832
|
const filteredLines = lines.filter((line) => !linesToRemove.includes(line.trim()));
|
|
845
833
|
if (filteredLines.length !== lines.length) await fs.writeFile(gitignorePath, filteredLines.join("\n"));
|
|
@@ -851,7 +839,7 @@ async function detachCommand() {
|
|
|
851
839
|
if (pulledSubagents > 0) console.log(chalk.green(` ✓ Pulled ${pulledSubagents} subagent(s) from platform`));
|
|
852
840
|
if (pulledMcpServers > 0) console.log(chalk.green(` ✓ Pulled ${pulledMcpServers} MCP server(s) from platform`));
|
|
853
841
|
console.log(chalk.green(" ✓ Removed Jive server from .mcp.json"));
|
|
854
|
-
console.log(chalk.green(" ✓
|
|
842
|
+
console.log(chalk.green(" ✓ Restored MCP server config"));
|
|
855
843
|
console.log(chalk.green(" ✓ Removed subagent-runner"));
|
|
856
844
|
console.log(chalk.green(" ✓ Removed .jive directory"));
|
|
857
845
|
console.log(chalk.green(" ✓ Cleaned up .gitignore"));
|