@kvell007/embed-labs-cli 0.1.0-alpha.43 → 0.1.0-alpha.45
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 +71 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -113,6 +113,7 @@ const BOARD_REGISTRY_LIST_USAGE = "Usage: embed board registry list [--json]";
|
|
|
113
113
|
const BOARD_REGISTRY_SHOW_USAGE = "Usage: embed board registry show <template_id> [--json]";
|
|
114
114
|
const BOARD_METHODS_USAGE = "Usage: embed board methods <template_id> [--json]";
|
|
115
115
|
const BOARD_KNOWLEDGE_USAGE = "Usage: embed board knowledge <template_id> [--json]";
|
|
116
|
+
const BOARD_KNOWLEDGE_SEARCH_USAGE = "Usage: embed board knowledge search <template_id> --query <text> [--source board_pack|build_template|registry] [--limit 5] [--json]";
|
|
116
117
|
const BOARD_KNOWLEDGE_FILE_USAGE = "Usage: embed board knowledge file <template_id> --source board_pack|build_template|registry --path <relative_path> [--output <local_path>] [--json]";
|
|
117
118
|
const MODEL_LIST_USAGE = "Usage: embed model list [--json]";
|
|
118
119
|
const MODEL_DEFAULT_USAGE = "Usage: embed model default [--json]";
|
|
@@ -236,6 +237,17 @@ async function main(argv) {
|
|
|
236
237
|
return output(parsed, await cloudGet(`/v1/board-registry/templates/${encodeURIComponent(idResult.value)}/methods`), renderBoardMethods);
|
|
237
238
|
}
|
|
238
239
|
if (action === "knowledge") {
|
|
240
|
+
if (parsed.command[2] === "search") {
|
|
241
|
+
const request = boardKnowledgeSearchRequest(parsed);
|
|
242
|
+
if (typeof request === "string") {
|
|
243
|
+
return output(parsed, fail("invalid_args", request), undefined, 2);
|
|
244
|
+
}
|
|
245
|
+
const params = new URLSearchParams({ q: request.query, limit: String(request.limit) });
|
|
246
|
+
if (request.source) {
|
|
247
|
+
params.set("source", request.source);
|
|
248
|
+
}
|
|
249
|
+
return output(parsed, await cloudGet(`/v1/board-registry/templates/${encodeURIComponent(request.templateId)}/knowledge-search?${params.toString()}`), renderBoardKnowledgeSearch);
|
|
250
|
+
}
|
|
239
251
|
if (parsed.command[2] === "file") {
|
|
240
252
|
const request = boardKnowledgeFileRequest(parsed);
|
|
241
253
|
if (typeof request === "string") {
|
|
@@ -261,6 +273,7 @@ async function main(argv) {
|
|
|
261
273
|
BOARD_REGISTRY_SHOW_USAGE,
|
|
262
274
|
BOARD_METHODS_USAGE,
|
|
263
275
|
BOARD_KNOWLEDGE_USAGE,
|
|
276
|
+
BOARD_KNOWLEDGE_SEARCH_USAGE,
|
|
264
277
|
BOARD_KNOWLEDGE_FILE_USAGE
|
|
265
278
|
].join("\n")), undefined, 2);
|
|
266
279
|
}
|
|
@@ -4659,6 +4672,47 @@ function boardKnowledgeFileRequest(parsed) {
|
|
|
4659
4672
|
outputPath: outputPath.value
|
|
4660
4673
|
};
|
|
4661
4674
|
}
|
|
4675
|
+
function boardKnowledgeSearchRequest(parsed) {
|
|
4676
|
+
const unknownFlag = firstUnknownFlag(parsed, ["json", "query", "source", "limit"]);
|
|
4677
|
+
if (unknownFlag) {
|
|
4678
|
+
return `Unknown flag --${unknownFlag}. ${BOARD_KNOWLEDGE_SEARCH_USAGE}`;
|
|
4679
|
+
}
|
|
4680
|
+
const templateId = parsed.command[3]?.trim();
|
|
4681
|
+
if (!templateId) {
|
|
4682
|
+
return BOARD_KNOWLEDGE_SEARCH_USAGE;
|
|
4683
|
+
}
|
|
4684
|
+
const extra = parsed.command.slice(4);
|
|
4685
|
+
if (extra.length > 0) {
|
|
4686
|
+
return `Unexpected argument: ${extra[0]}. ${BOARD_KNOWLEDGE_SEARCH_USAGE}`;
|
|
4687
|
+
}
|
|
4688
|
+
const query = optionalTrimmedStringFlag(parsed, "query");
|
|
4689
|
+
if (query.error) {
|
|
4690
|
+
return query.error;
|
|
4691
|
+
}
|
|
4692
|
+
if (!query.value) {
|
|
4693
|
+
return BOARD_KNOWLEDGE_SEARCH_USAGE;
|
|
4694
|
+
}
|
|
4695
|
+
const source = optionalTrimmedStringFlag(parsed, "source");
|
|
4696
|
+
if (source.error) {
|
|
4697
|
+
return source.error;
|
|
4698
|
+
}
|
|
4699
|
+
if (source.value && !["board_pack", "build_template", "registry"].includes(source.value)) {
|
|
4700
|
+
return BOARD_KNOWLEDGE_SEARCH_USAGE;
|
|
4701
|
+
}
|
|
4702
|
+
const limit = optionalPositiveIntegerFlag(parsed, "limit");
|
|
4703
|
+
if (limit.error) {
|
|
4704
|
+
return limit.error;
|
|
4705
|
+
}
|
|
4706
|
+
if (limit.value !== undefined && limit.value > 10) {
|
|
4707
|
+
return "--limit must be between 1 and 10.";
|
|
4708
|
+
}
|
|
4709
|
+
return {
|
|
4710
|
+
templateId,
|
|
4711
|
+
query: query.value,
|
|
4712
|
+
source: source.value,
|
|
4713
|
+
limit: limit.value ?? 5
|
|
4714
|
+
};
|
|
4715
|
+
}
|
|
4662
4716
|
function toolCallRequest(parsed) {
|
|
4663
4717
|
const unknownFlag = firstUnknownFlag(parsed, ["json", "input-json", "approve"]);
|
|
4664
4718
|
if (unknownFlag) {
|
|
@@ -6734,6 +6788,20 @@ function renderBoardKnowledge(data) {
|
|
|
6734
6788
|
`title=${file.title}`
|
|
6735
6789
|
].join(" ")).join("\n");
|
|
6736
6790
|
}
|
|
6791
|
+
function renderBoardKnowledgeSearch(data) {
|
|
6792
|
+
const result = data;
|
|
6793
|
+
const matches = Array.isArray(result.matches) ? result.matches : [];
|
|
6794
|
+
if (matches.length === 0) {
|
|
6795
|
+
return "No matching board knowledge snippets.";
|
|
6796
|
+
}
|
|
6797
|
+
return matches.map((match, index) => [
|
|
6798
|
+
`#${index + 1}`,
|
|
6799
|
+
`${match.source}:${match.path}`,
|
|
6800
|
+
`score=${match.score}`,
|
|
6801
|
+
`title=${match.title}`,
|
|
6802
|
+
`excerpt=${match.excerpt.replace(/\s+/g, " ").trim()}`
|
|
6803
|
+
].join(" ")).join("\n");
|
|
6804
|
+
}
|
|
6737
6805
|
function renderBoardKnowledgeFile(file) {
|
|
6738
6806
|
return [
|
|
6739
6807
|
`template=${file.template_id}`,
|
|
@@ -7963,6 +8031,7 @@ Main workflow:
|
|
|
7963
8031
|
embed board registry list
|
|
7964
8032
|
embed board methods taishanpi-1m-rk3566
|
|
7965
8033
|
embed board knowledge taishanpi-1m-rk3566
|
|
8034
|
+
embed board knowledge search taishanpi-1m-rk3566 --query "UART pinout"
|
|
7966
8035
|
embed build template list
|
|
7967
8036
|
embed build template show <template_id>
|
|
7968
8037
|
7. Provision and populate a build workspace:
|
|
@@ -8091,6 +8160,7 @@ Cloud build path:
|
|
|
8091
8160
|
embed board registry show taishanpi-1m-rk3566
|
|
8092
8161
|
embed board methods taishanpi-1m-rk3566
|
|
8093
8162
|
embed board knowledge taishanpi-1m-rk3566
|
|
8163
|
+
embed board knowledge search taishanpi-1m-rk3566 --query "UART pinout"
|
|
8094
8164
|
embed build template list
|
|
8095
8165
|
embed build template show <template_id>
|
|
8096
8166
|
embed build workspace provision --account <account_id> --project <project_id> --template <template_id>
|
|
@@ -8164,6 +8234,7 @@ Usage:
|
|
|
8164
8234
|
embed board registry show <template_id> [--json]
|
|
8165
8235
|
embed board methods <template_id> [--json]
|
|
8166
8236
|
embed board knowledge <template_id> [--json]
|
|
8237
|
+
embed board knowledge search <template_id> --query <text> [--source board_pack|build_template|registry] [--limit 5] [--json]
|
|
8167
8238
|
embed board knowledge file <template_id> --source board_pack|build_template|registry --path <relative_path> [--output <local_path>] [--json]
|
|
8168
8239
|
embed agent run --prompt <request> [--account <account_id>] [--workspace <workspace_id>] [--provider stub|openai|bai|cc|claude-code] [--model <model>] [--max-tool-calls 6] [--host <ip>] [--ports 22,15301] [--artifact <local_file>|--artifact-id <artifact_id>|--artifact-task <task_id>] [--artifact-output <path>] [--remote-path <path>] [--run] [--approve] [--json]
|
|
8169
8240
|
embed run <natural language request> [--provider stub|openai|bai|cc|claude-code] [--approve] [--json]
|