@seeed-studio/solution-cli 0.4.5 → 0.4.6
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/CHANGELOG.md +23 -0
- package/bin/cli.js +215 -64
- package/catalog/client-config.json +2 -1
- package/lib/knowledge.js +820 -174
- package/package.json +3 -2
- package/skills/solution-cli/SKILL.md +11 -0
- package/skills/solution-cli/references/consult-and-select.md +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,29 @@
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [0.4.6] - 2026-10-20
|
|
8
|
+
|
|
9
|
+
### 新增功能 (Added)
|
|
10
|
+
- **方案成功案例接入与动态检索 (`cases`)**:
|
|
11
|
+
- `hub get <id> --section cases` 支持在线拉取方案落地成功案例集合(Typesense `cc_success_cases` 集合与 Solution `related_posts` 融合),支持多语言与真实带 UTM 归因的落地页链接。
|
|
12
|
+
- 搜索结果(`hub search`)直出落地案例计数值,提供直观的客户落地证据。
|
|
13
|
+
- **单篇案例完整正文下钻 (`case get`)**:
|
|
14
|
+
- 新增顶层命令 `solution-cli case get <id_or_slug> [--locale zh|en|ja] [--json]`,支持获取 2000+ 字完整 Markdown 正文(`body_md`)、现场背景、工况挑战、合作伙伴与硬件清单。
|
|
15
|
+
- **产品模块渐进式披露与字段裁剪 (`--section`)**:
|
|
16
|
+
- `product search` 与 `product query` 新增 `--section <overview|power|interfaces|specs|all>` 支持:
|
|
17
|
+
- `--section power`:专用于供电、线缆、开箱即用与必需配件分析,裁剪掉无关网络接口与算力字段,大幅缩减上下文占用;
|
|
18
|
+
- `--section interfaces`:仅保留板载接口、通信协议与 I/O 外设扩展槽;
|
|
19
|
+
- `--section overview`:仅保留家族简介与各 SKU 开箱判定简述。
|
|
20
|
+
- **中文硬件泛称同义词匹配**:
|
|
21
|
+
- 针对“树莓派”、“工控机”等中文通用行业用词内置分词同义词表与在线回退匹配,避免直接搜索中文硬件无结果。
|
|
22
|
+
- **场景化防回退 Benchmark 评测套件**:
|
|
23
|
+
- 新增 `npm run benchmark`(18 个端到端用户场景),覆盖方案咨询、案例下钻、硬件开箱判定、同义词、芯片避坑、离线降级与部署契约。
|
|
24
|
+
|
|
25
|
+
### 体验与文档优化 (Documentation)
|
|
26
|
+
- **Agent Skill 技能升级**:更新 `SKILL.md` 与 `consult-and-select.md`,补充成功案例下钻与产品字段裁剪指引。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
7
30
|
## [0.4.5] - 2026-10-19
|
|
8
31
|
|
|
9
32
|
### 新增功能 (Added)
|
package/bin/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
5
|
import { runInstall, runUpdate, listAgents, runStatus, runUninstall } from '../lib/installer.js';
|
|
6
6
|
import { runDoctor } from '../lib/doctor.js';
|
|
7
|
-
import { searchHub, listHub, getHubRecord, loadKnowledgeCore, queryProductFamily, searchProducts, queryAccessories, createDeploymentLockfile } from '../lib/knowledge.js';
|
|
7
|
+
import { searchHub, listHub, getHubRecord, getHubRecordAsync, getCaseRecord, loadKnowledgeCore, queryProductFamily, searchProducts, searchProductsAsync, queryAccessories, createDeploymentLockfile, PRODUCT_SECTIONS } from '../lib/knowledge.js';
|
|
8
8
|
import { assertCompatibility } from '../lib/compatibility.js';
|
|
9
9
|
import { searchGotchas } from '../lib/gotchas.js';
|
|
10
10
|
|
|
@@ -33,10 +33,12 @@ Commands:
|
|
|
33
33
|
hub Search scenarios and reference designs from Seeed Solution Hub
|
|
34
34
|
Usage: solution-cli hub search <keyword> [--limit 5] [--locale zh|en|ja] [--json]
|
|
35
35
|
solution-cli hub list [--type scenario|tech|reference_design] [--page N] [--limit 50] [--locale zh|en|ja] [--json]
|
|
36
|
-
solution-cli hub get <id> [--type ...] [--section overview|links|description|architecture|products|deployment|playbook|integration] [--preset <id>] [--locale zh|en|ja] [--json]
|
|
36
|
+
solution-cli hub get <id> [--type ...] [--section overview|links|description|architecture|products|deployment|playbook|integration|cases] [--preset <id>] [--locale zh|en|ja] [--json]
|
|
37
|
+
case Retrieve full story, body markdown, and details of a success case
|
|
38
|
+
Usage: solution-cli case get <id_or_slug> [--locale zh|en|ja] [--json]
|
|
37
39
|
product Query product families, SKUs, physical interfaces, box contents, and verified accessories
|
|
38
|
-
Usage: solution-cli product search <keyword|model|sku> [--limit 5] [--locale zh|en|ja] [--json]
|
|
39
|
-
solution-cli product query <family_id> [--locale zh|en|ja] [--json]
|
|
40
|
+
Usage: solution-cli product search <keyword|model|sku> [--section overview|power|interfaces|specs|all] [--limit 5] [--locale zh|en|ja] [--json]
|
|
41
|
+
solution-cli product query <family_id> [--section overview|power|interfaces|specs|all] [--locale zh|en|ja] [--json]
|
|
40
42
|
solution-cli product accessories <family_id> [--sku <sku>] [--category <cats>] [--compact] [--json]
|
|
41
43
|
solution-cli product verify-compatibility --host <family_id> [--json]
|
|
42
44
|
gotchas Search edge hardware and chip troubleshooting knowledge (RK3588, reCamera, Jetson, Hailo)
|
|
@@ -210,7 +212,8 @@ function validateCommandFlags(command, flags) {
|
|
|
210
212
|
doctor: ['--json'],
|
|
211
213
|
agent: ['--json'],
|
|
212
214
|
hub: ['--json', '--compact', '--locale', '--limit', '--page', '--type', '--section', '--sections', '--preset'],
|
|
213
|
-
|
|
215
|
+
case: ['--json', '--locale'],
|
|
216
|
+
product: ['--json', '--compact', '--locale', '--sku', '--host', '--accessory', '--category', '--limit', '--section'],
|
|
214
217
|
gotchas: ['--json', '--chip'],
|
|
215
218
|
lockfile: ['--json', '--solution', '--version', '--hardware'],
|
|
216
219
|
help: [],
|
|
@@ -310,6 +313,22 @@ function renderSectionOutput(r, section) {
|
|
|
310
313
|
console.log('\n \x1b[35m[系统快速对接指引]\x1b[0m');
|
|
311
314
|
r.integration.system_ingestion_guide.forEach((g) => console.log(` ${g}`));
|
|
312
315
|
}
|
|
316
|
+
} else if (section === 'cases') {
|
|
317
|
+
console.log(` \x1b[36m[成功案例与客户实践 (Case Studies & Success Stories)]\x1b[0m`);
|
|
318
|
+
console.log(` 数据来源: ${r.cases?.source || 'bundled_manifest'} | 状态: ${r.cases?.availability || 'unavailable'}`);
|
|
319
|
+
const items = r.cases?.items || [];
|
|
320
|
+
if (items.length === 0) {
|
|
321
|
+
console.log(' 暂无结构化案例或当前处于离线状态。');
|
|
322
|
+
} else {
|
|
323
|
+
items.forEach((item, idx) => {
|
|
324
|
+
console.log(`\n \x1b[32m[案例 ${idx + 1}]\x1b[0m \x1b[1m${item.title}\x1b[0m`);
|
|
325
|
+
if (item.industry?.length) console.log(` 🏷️ 行业分类: ${item.industry.join(', ')}`);
|
|
326
|
+
if (item.region?.length) console.log(` 🌍 落地地区: ${item.region.join(', ')}`);
|
|
327
|
+
if (item.hardware?.length) console.log(` 🛠️ 采用硬件: ${item.hardware.join(', ')}`);
|
|
328
|
+
if (item.description) console.log(` 💡 案例概述: ${item.description}`);
|
|
329
|
+
if (item.url) console.log(` 🔗 详情链接: ${item.url}`);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
313
332
|
}
|
|
314
333
|
}
|
|
315
334
|
|
|
@@ -403,7 +422,7 @@ async function main() {
|
|
|
403
422
|
const listLimit = flags.usedFlags.has('--limit') ? flags.limit : 50;
|
|
404
423
|
dto = listHub({ type: flags.type, locale: flags.locale, page: flags.page, limit: listLimit });
|
|
405
424
|
} else if (sub === 'get') {
|
|
406
|
-
const row =
|
|
425
|
+
const row = await getHubRecordAsync(flags.positionals[1], {
|
|
407
426
|
type: flags.type,
|
|
408
427
|
locale: flags.locale,
|
|
409
428
|
section: flags.section,
|
|
@@ -415,16 +434,17 @@ async function main() {
|
|
|
415
434
|
process.exit(1);
|
|
416
435
|
}
|
|
417
436
|
const core = loadKnowledgeCore();
|
|
437
|
+
const rowSource = row.cases?.source === 'typesense' ? 'typesense' : 'bundled_manifest';
|
|
418
438
|
dto = {
|
|
419
439
|
records: [row],
|
|
420
|
-
source:
|
|
440
|
+
source: rowSource,
|
|
421
441
|
freshness: 'UNKNOWN',
|
|
422
442
|
dataset_version: core.dataset_version || null,
|
|
423
443
|
build_time: core.build_time || null,
|
|
424
444
|
provenance: core.provenance || null,
|
|
425
|
-
scope: 'bundled_catalog_snapshot',
|
|
445
|
+
scope: rowSource === 'typesense' ? 'typesense' : 'bundled_catalog_snapshot',
|
|
426
446
|
locale: flags.locale,
|
|
427
|
-
warnings: [],
|
|
447
|
+
warnings: row.warnings || [],
|
|
428
448
|
};
|
|
429
449
|
} else {
|
|
430
450
|
const query = flags.positionals.slice(1).join(' ');
|
|
@@ -477,6 +497,9 @@ async function main() {
|
|
|
477
497
|
}).join(', ');
|
|
478
498
|
console.log(` Available Sections: ${sectionSummary}`);
|
|
479
499
|
}
|
|
500
|
+
if (r.cases_count > 0) {
|
|
501
|
+
console.log(` \x1b[32m成功案例:\x1b[0m ${r.cases_count} 个落地案例 (使用 hub get ${r.id} --section cases 查看详情)`);
|
|
502
|
+
}
|
|
480
503
|
console.log('');
|
|
481
504
|
});
|
|
482
505
|
}
|
|
@@ -515,13 +538,24 @@ async function main() {
|
|
|
515
538
|
}
|
|
516
539
|
const familyId = queryTarget;
|
|
517
540
|
|
|
541
|
+
const productSection = flags.usedFlags.has('--section') ? String(flags.section).toLowerCase().trim() : 'all';
|
|
542
|
+
if (!PRODUCT_SECTIONS.has(productSection)) {
|
|
543
|
+
console.error(`Unsupported product section "${flags.section}". Supported: ${Array.from(PRODUCT_SECTIONS).join(', ')}.`);
|
|
544
|
+
process.exit(1);
|
|
545
|
+
}
|
|
546
|
+
|
|
518
547
|
if (sub === 'search') {
|
|
519
548
|
const q = (rawFirst === 'search' ? flags.positionals.slice(1).join(' ') : queryTarget) || '';
|
|
520
549
|
if (!q.trim()) {
|
|
521
550
|
console.error('Please specify a search query (e.g. "solution-cli product search J4012 Super")');
|
|
522
551
|
process.exit(1);
|
|
523
552
|
}
|
|
524
|
-
const dto =
|
|
553
|
+
const dto = await searchProductsAsync({
|
|
554
|
+
query: q,
|
|
555
|
+
locale: flags.locale,
|
|
556
|
+
limit: flags.limit ? parseInt(flags.limit, 10) : 5,
|
|
557
|
+
section: productSection,
|
|
558
|
+
});
|
|
525
559
|
if (flags.json) {
|
|
526
560
|
console.log(JSON.stringify(dto, null, 2));
|
|
527
561
|
} else {
|
|
@@ -531,64 +565,130 @@ async function main() {
|
|
|
531
565
|
console.log(`\n🔍 找到 ${dto.records.length} 个匹配的硬件产品族:`);
|
|
532
566
|
dto.records.forEach((fam) => {
|
|
533
567
|
console.log(`\n======================================================================`);
|
|
534
|
-
|
|
568
|
+
const sectionTag = productSection !== 'all' ? ` \x1b[33m[Section: ${productSection}]\x1b[0m` : '';
|
|
569
|
+
console.log(`📦 \x1b[1m${fam.title}\x1b[0m (Family ID: \x1b[36m${fam.family_id}\x1b[0m)${sectionTag}`);
|
|
535
570
|
if (fam.summary) console.log(` 💡 简介: ${fam.summary}`);
|
|
536
|
-
if (fam.interfaces?.length) console.log(` 🔌 板载接口 (Interfaces): ${fam.interfaces.join(', ')}`);
|
|
537
|
-
if (fam.protocols?.length) console.log(` 📡 通信协议 (Protocols): ${fam.protocols.join(', ')}`);
|
|
538
|
-
|
|
539
|
-
if (fam.supported_scenarios?.length) {
|
|
540
|
-
console.log(` 🚀 官方落地方案 (该设备可以干嘛):`);
|
|
541
|
-
fam.supported_scenarios.slice(0, 5).forEach((sc) => {
|
|
542
|
-
const scTitle = sc.title?.[flags.locale] || sc.title?.zh || sc.title?.en || sc.id;
|
|
543
|
-
console.log(` - \x1b[32m${scTitle}\x1b[0m (ID: ${sc.id})`);
|
|
544
|
-
});
|
|
545
|
-
}
|
|
546
571
|
|
|
547
|
-
if (
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
s.
|
|
571
|
-
console.log(`
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
console.log(`
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
572
|
+
if (productSection === 'power') {
|
|
573
|
+
if (fam.matched_skus?.length) {
|
|
574
|
+
console.log(` 🎯 型号供电与开箱配置:`);
|
|
575
|
+
fam.matched_skus.forEach((s) => {
|
|
576
|
+
console.log(` --------------------------------------------------`);
|
|
577
|
+
console.log(` SKU: \x1b[1m${s.sku}\x1b[0m | 型号: ${s.model || '标准款'} | 名称: ${s.name}`);
|
|
578
|
+
if (s.package_profile?.readiness_summary) {
|
|
579
|
+
const icon = s.package_profile.out_of_the_box_ready ? '\x1b[32m✔ 开箱即用\x1b[0m' : '\x1b[33m⚠️ 无法直接开机/需配件\x1b[0m';
|
|
580
|
+
console.log(` ⚡ 开箱状态: ${icon}`);
|
|
581
|
+
console.log(` ${s.package_profile.readiness_summary}`);
|
|
582
|
+
} else if (s.power?.adapter_included === true) {
|
|
583
|
+
console.log(` 🔌 电源适配器: \x1b[32m✔ 随附\x1b[0m (${s.power.adapter_spec || s.power.input_voltage || '标配适配器'})`);
|
|
584
|
+
} else if (s.power?.adapter_included === false) {
|
|
585
|
+
console.log(` 🔌 电源适配器: \x1b[31m✖ 不随附\x1b[0m (需要自备或加配: ${s.power.adapter_spec || s.power.input_voltage || '需外接电源'})`);
|
|
586
|
+
} else if (s.power?.input_voltage) {
|
|
587
|
+
console.log(` 🔌 供电要求: ${s.power.input_voltage} ${s.power.input_connector || ''}`);
|
|
588
|
+
}
|
|
589
|
+
if (s.required_accessories?.length) {
|
|
590
|
+
console.log(` 🔌 必需加配配件:`);
|
|
591
|
+
s.required_accessories.forEach((acc) => {
|
|
592
|
+
console.log(` • \x1b[1m${acc.name}\x1b[0m (SKU: ${acc.sku || 'N/A'})${acc.reason ? ` - ${acc.reason}` : ''}`);
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
if (s.package_contents?.length) {
|
|
596
|
+
console.log(` 📦 包装清单: ${s.package_contents.join(', ')}`);
|
|
597
|
+
}
|
|
598
|
+
if (s.url) console.log(` 🔗 购买链接: ${s.url}`);
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
} else if (productSection === 'interfaces') {
|
|
602
|
+
if (fam.interfaces?.length) console.log(` 🔌 板载接口 (Interfaces): ${fam.interfaces.join(', ')}`);
|
|
603
|
+
if (fam.protocols?.length) console.log(` 📡 通信协议 (Protocols): ${fam.protocols.join(', ')}`);
|
|
604
|
+
if (fam.matched_skus?.length) {
|
|
605
|
+
console.log(` 🎯 型号外设端口与扩展:`);
|
|
606
|
+
fam.matched_skus.forEach((s) => {
|
|
607
|
+
console.log(` --------------------------------------------------`);
|
|
608
|
+
console.log(` SKU: \x1b[1m${s.sku}\x1b[0m | 型号: ${s.model || '标准款'} | 名称: ${s.name}`);
|
|
609
|
+
if (s.interfaces?.length) console.log(` 🔌 接口: ${s.interfaces.join(', ')}`);
|
|
610
|
+
if (s.io_ports?.length) {
|
|
611
|
+
const portSummary = s.io_ports.map((p) => `${p.count}x ${p.type}${p.notes ? ` (${p.notes})` : ''}`).join(', ');
|
|
612
|
+
console.log(` 🖥️ 外设端口: ${portSummary}`);
|
|
613
|
+
}
|
|
614
|
+
if (s.expansion_slots?.length) {
|
|
615
|
+
const slotSummary = s.expansion_slots.map((sl) => `${sl.type}`).join(', ');
|
|
616
|
+
console.log(` 🧩 扩展槽位: ${slotSummary}`);
|
|
617
|
+
}
|
|
618
|
+
if (s.url) console.log(` 🔗 购买链接: ${s.url}`);
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
} else if (productSection === 'overview') {
|
|
622
|
+
if (fam.matched_skus?.length) {
|
|
623
|
+
console.log(` 🎯 SKU 概览 (${fam.matched_skus.length} 款):`);
|
|
624
|
+
fam.matched_skus.forEach((s) => {
|
|
625
|
+
const icon = s.out_of_the_box_ready ? '\x1b[32m✔\x1b[0m' : '\x1b[33m⚠️\x1b[0m';
|
|
626
|
+
console.log(` - SKU: \x1b[1m${s.sku}\x1b[0m (${s.model || '标准款'}) | ${s.name} [${icon} ${s.readiness_summary || ''}]`);
|
|
627
|
+
if (s.url) console.log(` 链接: ${s.url}`);
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
} else {
|
|
631
|
+
// all or specs
|
|
632
|
+
if (fam.interfaces?.length) console.log(` 🔌 板载接口 (Interfaces): ${fam.interfaces.join(', ')}`);
|
|
633
|
+
if (fam.protocols?.length) console.log(` 📡 通信协议 (Protocols): ${fam.protocols.join(', ')}`);
|
|
634
|
+
|
|
635
|
+
if (fam.supported_scenarios?.length) {
|
|
636
|
+
console.log(` 🚀 官方落地方案 (该设备可以干嘛):`);
|
|
637
|
+
fam.supported_scenarios.slice(0, 5).forEach((sc) => {
|
|
638
|
+
const scTitle = sc.title?.[flags.locale] || sc.title?.zh || sc.title?.en || sc.id;
|
|
639
|
+
console.log(` - \x1b[32m${scTitle}\x1b[0m (ID: ${sc.id})`);
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
if (fam.matched_skus?.length) {
|
|
644
|
+
console.log(` 🎯 具体型号 (SKU) & 开箱配置:`);
|
|
645
|
+
fam.matched_skus.forEach((s) => {
|
|
646
|
+
console.log(` --------------------------------------------------`);
|
|
647
|
+
console.log(` SKU: \x1b[1m${s.sku}\x1b[0m | 型号: ${s.model || '标准款'} | 名称: ${s.name}`);
|
|
648
|
+
if (s.ai_performance) console.log(` ⚡ 算力: ${s.ai_performance}`);
|
|
649
|
+
|
|
650
|
+
// Power & Readiness summary
|
|
651
|
+
if (s.package_profile?.readiness_summary) {
|
|
652
|
+
const icon = s.package_profile.out_of_the_box_ready ? '\x1b[32m✔ 开箱即用\x1b[0m' : '\x1b[33m⚠️ 无法直接开机/需配件\x1b[0m';
|
|
653
|
+
console.log(` ⚡ 开箱状态: ${icon}`);
|
|
654
|
+
console.log(` ${s.package_profile.readiness_summary}`);
|
|
655
|
+
} else if (s.power?.adapter_included === true) {
|
|
656
|
+
console.log(` 🔌 电源适配器: \x1b[32m✔ 随附\x1b[0m (${s.power.adapter_spec || s.power.input_voltage || '标配适配器'})`);
|
|
657
|
+
} else if (s.power?.adapter_included === false) {
|
|
658
|
+
console.log(` 🔌 电源适配器: \x1b[31m✖ 不随附\x1b[0m (需要自备或加配: ${s.power.adapter_spec || s.power.input_voltage || '需外接电源'})`);
|
|
659
|
+
} else if (s.power?.input_voltage) {
|
|
660
|
+
console.log(` 🔌 供电要求: ${s.power.input_voltage} ${s.power.input_connector || ''}`);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
// Required accessories if any
|
|
664
|
+
if (s.required_accessories?.length) {
|
|
665
|
+
console.log(` 🔌 必需加配配件:`);
|
|
666
|
+
s.required_accessories.forEach((acc) => {
|
|
667
|
+
console.log(` • \x1b[1m${acc.name}\x1b[0m (SKU: ${acc.sku || 'N/A'})${acc.reason ? ` - ${acc.reason}` : ''}`);
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// Package contents
|
|
672
|
+
if (s.package_contents?.length) {
|
|
673
|
+
console.log(` 📦 包装清单 (Box Contents):`);
|
|
674
|
+
s.package_contents.forEach((item) => console.log(` • ${item}`));
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// I/O ports
|
|
678
|
+
if (s.io_ports?.length) {
|
|
679
|
+
const portSummary = s.io_ports.map((p) => `${p.count}x ${p.type}${p.notes ? ` (${p.notes})` : ''}`).join(', ');
|
|
680
|
+
console.log(` 🖥️ 外设端口 (I/O Ports): ${portSummary}`);
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
if (s.url) console.log(` 🔗 购买链接: ${s.url}`);
|
|
684
|
+
});
|
|
685
|
+
}
|
|
589
686
|
}
|
|
590
687
|
});
|
|
591
688
|
console.log(`\n💡 提示: 查看该设备必需与推荐配件请使用: solution-cli product accessories <family_id>`);
|
|
689
|
+
if (productSection === 'all') {
|
|
690
|
+
console.log(`💡 渐进式披露建议: 可使用 --section <overview|power|interfaces|specs> 按需裁剪输出减少上下文占用。`);
|
|
691
|
+
}
|
|
592
692
|
}
|
|
593
693
|
}
|
|
594
694
|
} else if (sub === 'query') {
|
|
@@ -596,7 +696,7 @@ async function main() {
|
|
|
596
696
|
console.error('Please specify a product family ID (e.g. "solution-cli product query recomputer_j40")');
|
|
597
697
|
process.exit(1);
|
|
598
698
|
}
|
|
599
|
-
const dto = queryProductFamily(familyId, { locale: flags.locale });
|
|
699
|
+
const dto = queryProductFamily(familyId, { locale: flags.locale, section: productSection });
|
|
600
700
|
if (flags.json) {
|
|
601
701
|
console.log(JSON.stringify(dto, null, 2));
|
|
602
702
|
} else {
|
|
@@ -715,6 +815,57 @@ async function main() {
|
|
|
715
815
|
break;
|
|
716
816
|
}
|
|
717
817
|
|
|
818
|
+
case 'case': {
|
|
819
|
+
const rawFirst = flags.positionals[0];
|
|
820
|
+
let sub = rawFirst;
|
|
821
|
+
let targetSlug = flags.positionals[1];
|
|
822
|
+
|
|
823
|
+
if (sub !== 'get') {
|
|
824
|
+
// Auto routing: solution-cli case <slug_or_id>
|
|
825
|
+
targetSlug = flags.positionals.join(' ');
|
|
826
|
+
sub = 'get';
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
if (!targetSlug || !targetSlug.trim()) {
|
|
830
|
+
console.error('Please specify a case slug or ID (e.g. "solution-cli case get rice-pest-and-disease-monitoring-solution-to-ensure-a-bountiful-harvest")');
|
|
831
|
+
process.exit(1);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const dto = await getCaseRecord(targetSlug.trim(), { locale: flags.locale });
|
|
835
|
+
if (flags.json) {
|
|
836
|
+
console.log(JSON.stringify(dto, null, 2));
|
|
837
|
+
} else {
|
|
838
|
+
if (dto.records.length === 0) {
|
|
839
|
+
console.log(`未找到案例 "${targetSlug}"。${dto.warnings?.join(' ') || ''}`);
|
|
840
|
+
} else {
|
|
841
|
+
const c = dto.records[0];
|
|
842
|
+
console.log(`\n======================================================================`);
|
|
843
|
+
console.log(`📖 \x1b[1m${c.title}\x1b[0m (ID: \x1b[36m${c.id}\x1b[0m)`);
|
|
844
|
+
if (c.slug) console.log(` Slug: ${c.slug}`);
|
|
845
|
+
if (c.solution_ids?.length) console.log(` 🚀 关联方案 (Solution IDs): ${c.solution_ids.join(', ')}`);
|
|
846
|
+
if (c.hardware?.length) console.log(` 📦 使用硬件: ${c.hardware.join(', ')}`);
|
|
847
|
+
if (c.industry?.length || c.region?.length) {
|
|
848
|
+
const meta = [];
|
|
849
|
+
if (c.region?.length) meta.push(`地区: ${c.region.join(', ')}`);
|
|
850
|
+
if (c.industry?.length) meta.push(`行业: ${c.industry.join(', ')}`);
|
|
851
|
+
console.log(` 🌍 ${meta.join(' | ')}`);
|
|
852
|
+
}
|
|
853
|
+
if (c.url) console.log(` 🔗 案例原文: ${c.url}`);
|
|
854
|
+
if (c.excerpt) console.log(`\n💡 \x1b[33m摘要:\x1b[0m\n ${c.excerpt.replace(/\n/g, '\n ')}`);
|
|
855
|
+
if (c.body_md) {
|
|
856
|
+
console.log(`\n📄 \x1b[32m案例正文 (Full Story):\x1b[0m`);
|
|
857
|
+
console.log(`----------------------------------------------------------------------`);
|
|
858
|
+
console.log(c.body_md);
|
|
859
|
+
console.log(`----------------------------------------------------------------------`);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
if (dto.warnings?.length) {
|
|
863
|
+
dto.warnings.forEach((w) => console.log(`\x1b[33mNote:\x1b[0m ${w}`));
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
break;
|
|
867
|
+
}
|
|
868
|
+
|
|
718
869
|
case 'gotchas': {
|
|
719
870
|
const query = flags.positionals.join(' ');
|
|
720
871
|
const results = searchGotchas({ query, chip: flags.chip });
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
"host": "https://rel-search.seeedstudio.com",
|
|
6
6
|
"search_key_solution": "dNsKBp0Pepdz9tvyIY1O92EMOM00XCHv",
|
|
7
7
|
"search_key_reference_design": "rEy4VhZnqEmrduFG2e8uvfWMz5ZzXhjb",
|
|
8
|
-
"search_key_purchase_profile": ""
|
|
8
|
+
"search_key_purchase_profile": "YrowCXcDOGTt9KedslTEmeY0ZJEhlBml",
|
|
9
|
+
"search_key_cc_success_cases": "FIVCfDzHtAaZLbAXBa0DAFD7DKyqYCxm"
|
|
9
10
|
}
|
|
10
11
|
}
|