@jive-ai/cli 0.0.22 → 0.0.24

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.
Files changed (2) hide show
  1. package/dist/index.mjs +32 -113
  2. package/package.json +2 -1
package/dist/index.mjs CHANGED
@@ -211,63 +211,6 @@ function getApiClient() {
211
211
 
212
212
  //#endregion
213
213
  //#region src/commands/auth.ts
214
- async function signupCommand() {
215
- console.log(chalk.bold("\nšŸš€ Create Your Jive Account\n"));
216
- const response = await prompts([
217
- {
218
- type: "text",
219
- name: "email",
220
- message: "Email address:",
221
- validate: (value) => {
222
- if (!value) return "Email is required";
223
- if (!value.includes("@")) return "Please enter a valid email";
224
- return true;
225
- }
226
- },
227
- {
228
- type: "password",
229
- name: "password",
230
- message: "Password (min 8 characters):",
231
- validate: (value) => {
232
- if (!value) return "Password is required";
233
- if (value.length < 8) return "Password must be at least 8 characters";
234
- return true;
235
- }
236
- },
237
- {
238
- type: "password",
239
- name: "confirmPassword",
240
- message: "Confirm password:"
241
- }
242
- ]);
243
- if (response.password !== response.confirmPassword) {
244
- console.log(chalk.yellow("\nāŒ Passwords do not match"));
245
- return;
246
- }
247
- if (!response.email || !response.password) {
248
- console.log(chalk.yellow("\nāŒ Signup cancelled"));
249
- return;
250
- }
251
- const spinner = ora("Creating account...").start();
252
- try {
253
- const result = await getApiClient().signup(response.email, response.password);
254
- spinner.succeed(chalk.green("Account created successfully!"));
255
- console.log(chalk.cyan(`\nšŸ“§ Logged in as: ${result.email}`));
256
- console.log(chalk.gray(`\n${result.message || "Next, create or join a team to get started."}`));
257
- console.log(chalk.white("\nRun"), chalk.cyan("jive team create"), chalk.white("to create a team"));
258
- console.log(chalk.white("Or"), chalk.cyan("jive init"), chalk.white("to initialize your project with an existing team\n"));
259
- await saveCredentials({
260
- token: result.token,
261
- userId: result.userId,
262
- email: result.email
263
- });
264
- } catch (error) {
265
- spinner.fail(chalk.red("Signup failed"));
266
- console.error(chalk.red(`\nāŒ ${error.message || "An error occurred"}`));
267
- if (error.details) console.error(chalk.gray(JSON.stringify(error.details, null, 2)));
268
- process.exit(1);
269
- }
270
- }
271
214
  async function loginCommand() {
272
215
  console.log(chalk.bold("\nšŸ‘‹ Login to Jive\n"));
273
216
  const response = await prompts([{
@@ -402,7 +345,7 @@ const teamCommands = {
402
345
  process.exit(1);
403
346
  }
404
347
  },
405
- async switch() {
348
+ async select() {
406
349
  await requireAuth();
407
350
  const spinner = ora("Fetching teams...").start();
408
351
  try {
@@ -427,14 +370,14 @@ const teamCommands = {
427
370
  console.log(chalk.yellow("\nāŒ Team switch cancelled"));
428
371
  return;
429
372
  }
430
- const switchSpinner = ora("Switching team...").start();
373
+ const selectSpinner = ora("Selecting team...").start();
431
374
  if (await getProjectConfig()) await updateProjectConfig({ activeTeamId: response.teamId });
432
- switchSpinner.succeed(chalk.green("Team switched successfully!"));
375
+ selectSpinner.succeed(chalk.green("Team selected successfully!"));
433
376
  const selectedTeam = result.teams.find((t) => t.id.toString() === response.teamId);
434
- console.log(chalk.cyan(`\n✨ Active team: ${selectedTeam?.name}`));
377
+ console.log(chalk.cyan(`\n✨ Selected team: ${selectedTeam?.name}`));
435
378
  console.log(chalk.white("āœ… Your existing API key works for all teams\n"));
436
379
  } catch (error) {
437
- spinner.fail(chalk.red("Failed to switch team"));
380
+ spinner.fail(chalk.red("Failed to select team"));
438
381
  console.error(chalk.red(`\nāŒ ${error.message || "An error occurred"}`));
439
382
  process.exit(1);
440
383
  }
@@ -513,7 +456,7 @@ async function getSubagentFiles() {
513
456
  name: parsed.data.name || path.basename(file, ".md"),
514
457
  description: parsed.data.description || "",
515
458
  prompt: parsed.content.trim(),
516
- jiveId: parsed.data["jive-id"],
459
+ metadata: parsed.data,
517
460
  filePath
518
461
  });
519
462
  }
@@ -525,13 +468,20 @@ async function getSubagentFiles() {
525
468
  }
526
469
  async function saveSubagentFile(subagent) {
527
470
  await ensureAgentsDir();
471
+ const filePath = path.join(CLAUDE_AGENTS_DIR, `${subagent.name}.md`);
472
+ let existingFrontMatter = {};
473
+ try {
474
+ existingFrontMatter = matter(await fs.readFile(filePath, "utf-8")).data;
475
+ } catch (error) {}
528
476
  const frontmatter = {
477
+ ...existingFrontMatter,
529
478
  name: subagent.name,
530
479
  description: subagent.description
531
480
  };
532
- if (subagent.jiveId) frontmatter["jive-id"] = subagent.jiveId;
481
+ if (subagent.metadata) {
482
+ for (const [key, value] of Object.entries(subagent.metadata)) if (key !== "name" && key !== "description") frontmatter[key] = value;
483
+ }
533
484
  const content = matter.stringify(subagent.prompt, frontmatter);
534
- const filePath = path.join(CLAUDE_AGENTS_DIR, `${subagent.name}.md`);
535
485
  await fs.writeFile(filePath, content);
536
486
  return filePath;
537
487
  }
@@ -543,13 +493,6 @@ async function deleteSubagentFile(name) {
543
493
  if (error.code !== "ENOENT") throw error;
544
494
  }
545
495
  }
546
- async function updateSubagentJiveId(name, jiveId) {
547
- const filePath = path.join(CLAUDE_AGENTS_DIR, `${name}.md`);
548
- const parsed = matter(await fs.readFile(filePath, "utf-8"));
549
- parsed.data["jive-id"] = jiveId;
550
- const updated = matter.stringify(parsed.content, parsed.data);
551
- await fs.writeFile(filePath, updated);
552
- }
553
496
  async function createSubagentRunner() {
554
497
  await ensureAgentsDir();
555
498
  const runnerContent = `---
@@ -709,9 +652,9 @@ async function initCommand() {
709
652
  const created = await apiClient$1.createSubagent(teamId, {
710
653
  name: subagent.name,
711
654
  description: subagent.description,
712
- prompt: subagent.prompt
655
+ prompt: subagent.prompt,
656
+ metadata: subagent.metadata
713
657
  });
714
- await updateSubagentJiveId(subagent.name, created.id);
715
658
  uploadedSubagents.push({
716
659
  name: subagent.name,
717
660
  id: created.id
@@ -920,7 +863,7 @@ const subagentCommands = {
920
863
  name: subagent.name,
921
864
  description: subagent.description,
922
865
  prompt: subagent.prompt,
923
- jiveId: subagent.id
866
+ metadata: subagent.metadata
924
867
  });
925
868
  pulled++;
926
869
  }
@@ -942,13 +885,15 @@ const subagentCommands = {
942
885
  try {
943
886
  const apiClient$1 = getApiClient();
944
887
  const localSubagents = await getSubagentFiles();
888
+ const remoteSubagents = await apiClient$1.getSubagents(teamId);
945
889
  if (localSubagents.length === 0) {
946
890
  spinner.info(chalk.yellow("No local subagents to push"));
947
891
  return;
948
892
  }
949
893
  let created = 0;
950
894
  let updated = 0;
951
- const toUpdate = localSubagents.filter((s) => s.jiveId && s.name !== "subagent-runner");
895
+ const remoteSubagentMap = new Map(remoteSubagents.map((s) => [s.name, s]));
896
+ const toUpdate = localSubagents.filter((s) => s.name !== "subagent-runner" && remoteSubagentMap.has(s.name));
952
897
  let changeMessage = options.message;
953
898
  if (toUpdate.length > 0 && !changeMessage) {
954
899
  spinner.stop();
@@ -961,21 +906,23 @@ const subagentCommands = {
961
906
  }
962
907
  for (const subagent of localSubagents) {
963
908
  if (subagent.name === "subagent-runner") continue;
964
- if (subagent.jiveId) {
965
- await apiClient$1.updateSubagent(subagent.jiveId, {
909
+ const remoteSubagent = remoteSubagentMap.get(subagent.name);
910
+ if (remoteSubagent) {
911
+ await apiClient$1.updateSubagent(remoteSubagent.id, {
966
912
  name: subagent.name,
967
913
  description: subagent.description,
968
914
  prompt: subagent.prompt,
915
+ metadata: subagent.metadata,
969
916
  changeMessage: changeMessage || void 0
970
917
  });
971
918
  updated++;
972
919
  } else {
973
- const result = await apiClient$1.createSubagent(teamId, {
920
+ await apiClient$1.createSubagent(teamId, {
974
921
  name: subagent.name,
975
922
  description: subagent.description,
976
- prompt: subagent.prompt
923
+ prompt: subagent.prompt,
924
+ metadata: subagent.metadata
977
925
  });
978
- await updateSubagentJiveId(subagent.name, result.id);
979
926
  created++;
980
927
  }
981
928
  }
@@ -1031,7 +978,7 @@ const subagentCommands = {
1031
978
  name: result.name,
1032
979
  description: result.description,
1033
980
  prompt: result.prompt,
1034
- jiveId: result.id
981
+ metadata: result.metadata
1035
982
  });
1036
983
  spinner.succeed(chalk.green("Subagent created successfully!"));
1037
984
  console.log(chalk.cyan(`\n✨ ${result.name}`));
@@ -1851,28 +1798,7 @@ const mcpCommands = {
1851
1798
  };
1852
1799
 
1853
1800
  //#endregion
1854
- //#region src/commands/sync.ts
1855
- async function syncCommand(options) {
1856
- await requireAuth();
1857
- await getActiveTeamId();
1858
- if (options.dryRun) console.log(chalk.bold("\nšŸ” Dry Run Mode (no changes will be made)\n"));
1859
- else console.log(chalk.bold("\nšŸ”„ Synchronizing Resources\n"));
1860
- if (options.dryRun) {
1861
- console.log(chalk.yellow("Dry run mode not yet implemented"));
1862
- console.log(chalk.gray("For now, sync will proceed with actual changes\n"));
1863
- }
1864
- try {
1865
- console.log(chalk.cyan("šŸ“„ Pulling subagents..."));
1866
- await subagentCommands.pull({ overwrite: false });
1867
- console.log(chalk.cyan("šŸ“„ Pulling MCP servers..."));
1868
- await mcpCommands.pull({ merge: true });
1869
- console.log(chalk.green.bold("\nāœ… Sync completed successfully!\n"));
1870
- } catch (error) {
1871
- console.error(chalk.red("\nāŒ Sync failed"));
1872
- console.error(chalk.red(`${error.message}\n`));
1873
- process.exit(1);
1874
- }
1875
- }
1801
+ //#region src/commands/status.ts
1876
1802
  async function statusCommand() {
1877
1803
  await requireAuth();
1878
1804
  const teamId = await getActiveTeamId();
@@ -2117,20 +2043,18 @@ async function checkTeamMembership() {
2117
2043
 
2118
2044
  //#endregion
2119
2045
  //#region package.json
2120
- var version = "0.0.22";
2046
+ var version = "0.0.24";
2121
2047
 
2122
2048
  //#endregion
2123
2049
  //#region src/index.ts
2124
2050
  const program = new Command();
2125
2051
  program.name("jive").description("CLI tool for managing MCP servers, tools, and subagents across teams").version(version);
2126
2052
  program.command("login").description("Authenticate with the Jive platform").action(loginCommand);
2127
- program.command("signup").description("Create a new account").action(signupCommand);
2128
2053
  program.command("logout").description("Clear authentication credentials").action(logoutCommand);
2129
2054
  const team = program.command("team").description("Manage teams");
2130
2055
  team.command("create").description("Create a new team").action(teamCommands.create);
2131
2056
  team.command("list").description("List all teams you're a member of").action(teamCommands.list);
2132
- team.command("switch").description("Switch active team context").action(teamCommands.switch);
2133
- team.command("invite").description("Invite user to current team").argument("<email>", "Email address of user to invite").action(teamCommands.invite);
2057
+ team.command("select").description("Select active team context").action(teamCommands.select);
2134
2058
  program.command("init").description("Initialize Jive in current project").action(initCommand);
2135
2059
  program.command("detach").description("Remove Jive integrations from current project").action(detachCommand);
2136
2060
  program.command("doctor").description("Check Jive installation and configuration").action(doctorCommand);
@@ -2138,16 +2062,11 @@ const subagents = program.command("subagents").description("Manage subagents");
2138
2062
  subagents.command("list").description("List all subagents for active team").action(subagentCommands.list);
2139
2063
  subagents.command("pull").description("Download team subagents to local .claude/agents/ directory").option("--overwrite", "Overwrite existing files").action(subagentCommands.pull);
2140
2064
  subagents.command("push").description("Upload local subagents to team").option("--force", "Force push without conflict checks").option("-m, --message <text>", "Change description for version history").action(subagentCommands.push);
2141
- subagents.command("create").description("Create a new subagent interactively").action(subagentCommands.create);
2142
- subagents.command("delete").description("Delete a subagent").argument("<name-or-id>", "Name or ID of subagent to delete").action(subagentCommands.delete);
2143
2065
  const mcp = program.command("mcp").description("Manage MCP servers");
2144
2066
  mcp.command("list").description("List all MCP servers for active team").action(mcpCommands.list);
2145
2067
  mcp.command("pull").description("Download team MCP servers to local .mcp.json").option("--merge", "Merge with local servers instead of replacing").action(mcpCommands.pull);
2146
2068
  mcp.command("push").description("Upload local MCP servers to team").option("--force", "Force push without conflict checks").action(mcpCommands.push);
2147
- mcp.command("add").description("Add a new MCP server to team").argument("<name>", "Name of the MCP server").action(mcpCommands.add);
2148
- mcp.command("remove").description("Remove an MCP server from team").argument("<name-or-id>", "Name or ID of MCP server to remove").action(mcpCommands.remove);
2149
2069
  mcp.command("start").description("Start the MCP server").action(mcpCommands.start);
2150
- program.command("sync").description("Synchronize all resources between local and team").option("--dry-run", "Show what would be changed without making changes").action(syncCommand);
2151
2070
  program.command("status").description("Show sync status of local resources").action(statusCommand);
2152
2071
  program.parse();
2153
2072
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@jive-ai/cli",
4
- "version": "0.0.22",
4
+ "version": "0.0.24",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "dist",
@@ -30,6 +30,7 @@
30
30
  "@modelcontextprotocol/sdk": "^1.22.0",
31
31
  "axios": "^1.13.2",
32
32
  "chalk": "^5.6.2",
33
+ "change-case": "^5.4.4",
33
34
  "commander": "^14.0.2",
34
35
  "dedent": "^1.7.0",
35
36
  "gray-matter": "^4.0.3",