@erdoai/cli 0.125.0 → 0.126.0
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.js +22 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1622,6 +1622,9 @@ var ErdoClient = class {
|
|
|
1622
1622
|
getKnowledge(id) {
|
|
1623
1623
|
return this.request("GET", `/v1/knowledge/${encodeURIComponent(id)}`);
|
|
1624
1624
|
}
|
|
1625
|
+
createKnowledge(input) {
|
|
1626
|
+
return this.request("POST", "/v1/knowledge", input);
|
|
1627
|
+
}
|
|
1625
1628
|
updateKnowledge(id, input) {
|
|
1626
1629
|
return this.request("POST", `/v1/knowledge/${encodeURIComponent(id)}/actions`, {
|
|
1627
1630
|
action: "update",
|
|
@@ -8356,6 +8359,22 @@ pipelinesCmd.command("executions <slug>").description("Show an event pipeline's
|
|
|
8356
8359
|
}
|
|
8357
8360
|
});
|
|
8358
8361
|
var knowledgeCmd = program.command("knowledge").description("Knowledge objects");
|
|
8362
|
+
knowledgeCmd.command("create").description("Create a Knowledge object").requiredOption("--title <title>", "title").requiredOption("--body <body>", "body text, or @file").option("--description <description>", "short description").option("--type <type>", "snippet or skill", "snippet").option("--category <category>", "category").option("--tags <tags>", "comma-separated tags").option("--agent <name>", "name of the agent making the write").action(async (opts) => {
|
|
8363
|
+
try {
|
|
8364
|
+
const body = readMaybeFile(opts.body) ?? "";
|
|
8365
|
+
print(await new ErdoClient().createKnowledge({
|
|
8366
|
+
title: opts.title,
|
|
8367
|
+
content: body,
|
|
8368
|
+
description: opts.description ?? opts.title,
|
|
8369
|
+
type: opts.type,
|
|
8370
|
+
category: opts.category,
|
|
8371
|
+
tags: opts.tags?.split(",").map((tag) => tag.trim()).filter(Boolean),
|
|
8372
|
+
agent: opts.agent
|
|
8373
|
+
}));
|
|
8374
|
+
} catch (e) {
|
|
8375
|
+
fail(e);
|
|
8376
|
+
}
|
|
8377
|
+
});
|
|
8359
8378
|
knowledgeCmd.command("get <id>").description("Get one full typed Knowledge object, including links and related objects").action(async (id) => {
|
|
8360
8379
|
try {
|
|
8361
8380
|
print(await new ErdoClient().getKnowledge(id));
|
|
@@ -8363,7 +8382,7 @@ knowledgeCmd.command("get <id>").description("Get one full typed Knowledge objec
|
|
|
8363
8382
|
fail(e);
|
|
8364
8383
|
}
|
|
8365
8384
|
});
|
|
8366
|
-
knowledgeCmd.command("update <id>").description("Update a Knowledge object while preserving fields omitted from the command").option("--body <value>", "new body text, or @file; pass an empty value to clear the body").option("--config <file>", "JSON object file containing the complete replacement config, or @file").option("--title <title>", "new title").action(async (id, opts) => {
|
|
8385
|
+
knowledgeCmd.command("update <id>").description("Update a Knowledge object while preserving fields omitted from the command").option("--body <value>", "new body text, or @file; pass an empty value to clear the body").option("--config <file>", "JSON object file containing the complete replacement config, or @file").option("--title <title>", "new title").option("--agent <name>", "name of the agent making the write").action(async (id, opts) => {
|
|
8367
8386
|
try {
|
|
8368
8387
|
if (opts.title === void 0 && opts.body === void 0 && opts.config === void 0) {
|
|
8369
8388
|
throw new Error("provide at least one of --title, --body, or --config");
|
|
@@ -8380,7 +8399,8 @@ knowledgeCmd.command("update <id>").description("Update a Knowledge object while
|
|
|
8380
8399
|
title: opts.title ?? object.title,
|
|
8381
8400
|
body_markdown: replacementBody ?? object.body_markdown,
|
|
8382
8401
|
config_json: replacementConfig ?? object.config_json,
|
|
8383
|
-
expected_updated_at: object.updated_at
|
|
8402
|
+
expected_updated_at: object.updated_at,
|
|
8403
|
+
agent: opts.agent
|
|
8384
8404
|
}));
|
|
8385
8405
|
} catch (e) {
|
|
8386
8406
|
fail(e);
|