@jive-ai/cli 0.0.23 → 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.
- package/dist/index.mjs +25 -21
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -456,7 +456,7 @@ async function getSubagentFiles() {
|
|
|
456
456
|
name: parsed.data.name || path.basename(file, ".md"),
|
|
457
457
|
description: parsed.data.description || "",
|
|
458
458
|
prompt: parsed.content.trim(),
|
|
459
|
-
|
|
459
|
+
metadata: parsed.data,
|
|
460
460
|
filePath
|
|
461
461
|
});
|
|
462
462
|
}
|
|
@@ -468,13 +468,20 @@ async function getSubagentFiles() {
|
|
|
468
468
|
}
|
|
469
469
|
async function saveSubagentFile(subagent) {
|
|
470
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) {}
|
|
471
476
|
const frontmatter = {
|
|
477
|
+
...existingFrontMatter,
|
|
472
478
|
name: subagent.name,
|
|
473
479
|
description: subagent.description
|
|
474
480
|
};
|
|
475
|
-
if (subagent.
|
|
481
|
+
if (subagent.metadata) {
|
|
482
|
+
for (const [key, value] of Object.entries(subagent.metadata)) if (key !== "name" && key !== "description") frontmatter[key] = value;
|
|
483
|
+
}
|
|
476
484
|
const content = matter.stringify(subagent.prompt, frontmatter);
|
|
477
|
-
const filePath = path.join(CLAUDE_AGENTS_DIR, `${subagent.name}.md`);
|
|
478
485
|
await fs.writeFile(filePath, content);
|
|
479
486
|
return filePath;
|
|
480
487
|
}
|
|
@@ -486,13 +493,6 @@ async function deleteSubagentFile(name) {
|
|
|
486
493
|
if (error.code !== "ENOENT") throw error;
|
|
487
494
|
}
|
|
488
495
|
}
|
|
489
|
-
async function updateSubagentJiveId(name, jiveId) {
|
|
490
|
-
const filePath = path.join(CLAUDE_AGENTS_DIR, `${name}.md`);
|
|
491
|
-
const parsed = matter(await fs.readFile(filePath, "utf-8"));
|
|
492
|
-
parsed.data["jive-id"] = jiveId;
|
|
493
|
-
const updated = matter.stringify(parsed.content, parsed.data);
|
|
494
|
-
await fs.writeFile(filePath, updated);
|
|
495
|
-
}
|
|
496
496
|
async function createSubagentRunner() {
|
|
497
497
|
await ensureAgentsDir();
|
|
498
498
|
const runnerContent = `---
|
|
@@ -652,9 +652,9 @@ async function initCommand() {
|
|
|
652
652
|
const created = await apiClient$1.createSubagent(teamId, {
|
|
653
653
|
name: subagent.name,
|
|
654
654
|
description: subagent.description,
|
|
655
|
-
prompt: subagent.prompt
|
|
655
|
+
prompt: subagent.prompt,
|
|
656
|
+
metadata: subagent.metadata
|
|
656
657
|
});
|
|
657
|
-
await updateSubagentJiveId(subagent.name, created.id);
|
|
658
658
|
uploadedSubagents.push({
|
|
659
659
|
name: subagent.name,
|
|
660
660
|
id: created.id
|
|
@@ -863,7 +863,7 @@ const subagentCommands = {
|
|
|
863
863
|
name: subagent.name,
|
|
864
864
|
description: subagent.description,
|
|
865
865
|
prompt: subagent.prompt,
|
|
866
|
-
|
|
866
|
+
metadata: subagent.metadata
|
|
867
867
|
});
|
|
868
868
|
pulled++;
|
|
869
869
|
}
|
|
@@ -885,13 +885,15 @@ const subagentCommands = {
|
|
|
885
885
|
try {
|
|
886
886
|
const apiClient$1 = getApiClient();
|
|
887
887
|
const localSubagents = await getSubagentFiles();
|
|
888
|
+
const remoteSubagents = await apiClient$1.getSubagents(teamId);
|
|
888
889
|
if (localSubagents.length === 0) {
|
|
889
890
|
spinner.info(chalk.yellow("No local subagents to push"));
|
|
890
891
|
return;
|
|
891
892
|
}
|
|
892
893
|
let created = 0;
|
|
893
894
|
let updated = 0;
|
|
894
|
-
const
|
|
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));
|
|
895
897
|
let changeMessage = options.message;
|
|
896
898
|
if (toUpdate.length > 0 && !changeMessage) {
|
|
897
899
|
spinner.stop();
|
|
@@ -904,21 +906,23 @@ const subagentCommands = {
|
|
|
904
906
|
}
|
|
905
907
|
for (const subagent of localSubagents) {
|
|
906
908
|
if (subagent.name === "subagent-runner") continue;
|
|
907
|
-
|
|
908
|
-
|
|
909
|
+
const remoteSubagent = remoteSubagentMap.get(subagent.name);
|
|
910
|
+
if (remoteSubagent) {
|
|
911
|
+
await apiClient$1.updateSubagent(remoteSubagent.id, {
|
|
909
912
|
name: subagent.name,
|
|
910
913
|
description: subagent.description,
|
|
911
914
|
prompt: subagent.prompt,
|
|
915
|
+
metadata: subagent.metadata,
|
|
912
916
|
changeMessage: changeMessage || void 0
|
|
913
917
|
});
|
|
914
918
|
updated++;
|
|
915
919
|
} else {
|
|
916
|
-
|
|
920
|
+
await apiClient$1.createSubagent(teamId, {
|
|
917
921
|
name: subagent.name,
|
|
918
922
|
description: subagent.description,
|
|
919
|
-
prompt: subagent.prompt
|
|
923
|
+
prompt: subagent.prompt,
|
|
924
|
+
metadata: subagent.metadata
|
|
920
925
|
});
|
|
921
|
-
await updateSubagentJiveId(subagent.name, result.id);
|
|
922
926
|
created++;
|
|
923
927
|
}
|
|
924
928
|
}
|
|
@@ -974,7 +978,7 @@ const subagentCommands = {
|
|
|
974
978
|
name: result.name,
|
|
975
979
|
description: result.description,
|
|
976
980
|
prompt: result.prompt,
|
|
977
|
-
|
|
981
|
+
metadata: result.metadata
|
|
978
982
|
});
|
|
979
983
|
spinner.succeed(chalk.green("Subagent created successfully!"));
|
|
980
984
|
console.log(chalk.cyan(`\n✨ ${result.name}`));
|
|
@@ -2039,7 +2043,7 @@ async function checkTeamMembership() {
|
|
|
2039
2043
|
|
|
2040
2044
|
//#endregion
|
|
2041
2045
|
//#region package.json
|
|
2042
|
-
var version = "0.0.
|
|
2046
|
+
var version = "0.0.24";
|
|
2043
2047
|
|
|
2044
2048
|
//#endregion
|
|
2045
2049
|
//#region src/index.ts
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@jive-ai/cli",
|
|
4
|
-
"version": "0.0.
|
|
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",
|