@jive-ai/cli 0.0.10 → 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 +24 -15
- 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);
|
|
@@ -1337,17 +1344,19 @@ function log(...args) {
|
|
|
1337
1344
|
*/
|
|
1338
1345
|
async function startMcpServer() {
|
|
1339
1346
|
log("=== Jive Server Starting ===");
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
log("Error: JIVE_API_KEY environment variable is required");
|
|
1344
|
-
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`");
|
|
1345
1350
|
process.exit(1);
|
|
1351
|
+
return;
|
|
1346
1352
|
}
|
|
1347
|
-
|
|
1348
|
-
|
|
1353
|
+
const apiKey = (await getCredentials())?.token;
|
|
1354
|
+
if (!apiKey) {
|
|
1355
|
+
log("Error: No API key found, please login with `jive login`");
|
|
1349
1356
|
process.exit(1);
|
|
1357
|
+
return;
|
|
1350
1358
|
}
|
|
1359
|
+
const apiUrl = API_URL;
|
|
1351
1360
|
log(`Jive server connecting to ${apiUrl}`);
|
|
1352
1361
|
const connectionManager = new McpConnectionManager();
|
|
1353
1362
|
try {
|
|
@@ -2055,7 +2064,7 @@ async function checkTeamMembership() {
|
|
|
2055
2064
|
|
|
2056
2065
|
//#endregion
|
|
2057
2066
|
//#region package.json
|
|
2058
|
-
var version = "0.0.
|
|
2067
|
+
var version = "0.0.11";
|
|
2059
2068
|
|
|
2060
2069
|
//#endregion
|
|
2061
2070
|
//#region src/index.ts
|