@jive-ai/cli 0.0.10 → 0.0.12
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 +32 -24
- 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);
|
|
@@ -91,8 +98,12 @@ async function requireProjectConfig() {
|
|
|
91
98
|
return config;
|
|
92
99
|
}
|
|
93
100
|
async function getActiveTeamId() {
|
|
94
|
-
const
|
|
95
|
-
|
|
101
|
+
const teamId = (await requireProjectConfig()).activeTeamId;
|
|
102
|
+
if (!teamId) {
|
|
103
|
+
console.error(chalk.red("No team ID found, select one with `jive team switch`"));
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
return teamId;
|
|
96
107
|
}
|
|
97
108
|
async function isProjectInitialized() {
|
|
98
109
|
return await getProjectConfig() !== null;
|
|
@@ -413,10 +424,7 @@ const teamCommands = {
|
|
|
413
424
|
return;
|
|
414
425
|
}
|
|
415
426
|
const switchSpinner = ora("Switching team...").start();
|
|
416
|
-
if (await getProjectConfig()) await updateProjectConfig({
|
|
417
|
-
activeTeamId: response.teamId,
|
|
418
|
-
teamId: response.teamId
|
|
419
|
-
});
|
|
427
|
+
if (await getProjectConfig()) await updateProjectConfig({ activeTeamId: response.teamId });
|
|
420
428
|
switchSpinner.succeed(chalk.green("Team switched successfully!"));
|
|
421
429
|
const selectedTeam = result.teams.find((t) => t.id.toString() === response.teamId);
|
|
422
430
|
console.log(chalk.cyan(`\n✨ Active team: ${selectedTeam?.name}`));
|
|
@@ -723,7 +731,6 @@ async function initCommand() {
|
|
|
723
731
|
await addToGitignore(".jive");
|
|
724
732
|
spinner.text = "Creating project configuration...";
|
|
725
733
|
await saveProjectConfig({
|
|
726
|
-
teamId,
|
|
727
734
|
activeTeamId: teamId,
|
|
728
735
|
lastSync: (/* @__PURE__ */ new Date()).toISOString()
|
|
729
736
|
});
|
|
@@ -770,7 +777,7 @@ async function detachCommand() {
|
|
|
770
777
|
const projectConfig = await getProjectConfig();
|
|
771
778
|
await requireAuth();
|
|
772
779
|
const apiClient$1 = getApiClient();
|
|
773
|
-
const teamId = projectConfig?.activeTeamId
|
|
780
|
+
const teamId = projectConfig?.activeTeamId;
|
|
774
781
|
if (!teamId) {
|
|
775
782
|
console.error(chalk.red("No team ID found, select one with `jive team switch`"));
|
|
776
783
|
process.exit(1);
|
|
@@ -1337,17 +1344,18 @@ function log(...args) {
|
|
|
1337
1344
|
*/
|
|
1338
1345
|
async function startMcpServer() {
|
|
1339
1346
|
log("=== Jive Server Starting ===");
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
if (!apiKey) {
|
|
1343
|
-
log("Error: JIVE_API_KEY environment variable is required");
|
|
1344
|
-
log("Usage: JIVE_API_KEY=jive_xxx npm run mcp");
|
|
1347
|
+
if (!(await getProjectConfig())?.activeTeamId) {
|
|
1348
|
+
log("Error: No team ID found, select one with `jive team switch`");
|
|
1345
1349
|
process.exit(1);
|
|
1350
|
+
return;
|
|
1346
1351
|
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1352
|
+
const apiKey = (await getCredentials())?.token;
|
|
1353
|
+
if (!apiKey) {
|
|
1354
|
+
log("Error: No API key found, please login with `jive login`");
|
|
1349
1355
|
process.exit(1);
|
|
1356
|
+
return;
|
|
1350
1357
|
}
|
|
1358
|
+
const apiUrl = API_URL;
|
|
1351
1359
|
log(`Jive server connecting to ${apiUrl}`);
|
|
1352
1360
|
const connectionManager = new McpConnectionManager();
|
|
1353
1361
|
try {
|
|
@@ -1914,7 +1922,7 @@ async function checkProjectInit() {
|
|
|
1914
1922
|
return {
|
|
1915
1923
|
status: "pass",
|
|
1916
1924
|
message: "Project initialized",
|
|
1917
|
-
details: `Team ID: ${config.
|
|
1925
|
+
details: `Team ID: ${config.activeTeamId}`
|
|
1918
1926
|
};
|
|
1919
1927
|
} catch (error) {
|
|
1920
1928
|
return {
|
|
@@ -2055,7 +2063,7 @@ async function checkTeamMembership() {
|
|
|
2055
2063
|
|
|
2056
2064
|
//#endregion
|
|
2057
2065
|
//#region package.json
|
|
2058
|
-
var version = "0.0.
|
|
2066
|
+
var version = "0.0.12";
|
|
2059
2067
|
|
|
2060
2068
|
//#endregion
|
|
2061
2069
|
//#region src/index.ts
|