dsh-plugin-lcsc 0.0.0-stage → 0.2.1
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/LICENSE +21 -0
- package/README.md +95 -3
- package/cordis.patch.yml +11 -0
- package/data.js +1765 -0
- package/icon.svg +9 -0
- package/index.js +1601 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +52 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BOM_assitant contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,95 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# dsh-plugin-lcsc
|
|
2
|
+
|
|
3
|
+
> 立创商城 / 嘉立创选料与 BOM 成本体检,为 DeepSeek Harness 提供 2 个工具。
|
|
4
|
+
> LCSC/JLCPCB part finder and BOM cost auditor for DeepSeek Harness agents.
|
|
5
|
+
|
|
6
|
+
只暴露 **2 个工具**,避免与其他插件一起装时污染模型上下文。
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
# 从 npm(发布后)
|
|
12
|
+
dsh plugin --profile web add dsh-plugin-lcsc
|
|
13
|
+
|
|
14
|
+
# 从本地目录
|
|
15
|
+
dsh plugin --profile web add /path/to/lcsc-dsh-plugin
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
装完重启宿主(`dsh web` / 关闭重开)。这是 host-only bundle,不产生 UI 面板。
|
|
19
|
+
`engines.dsh` 要求 `>=0.2.2-rc.1 <0.3.0`。
|
|
20
|
+
|
|
21
|
+
## 两个工具
|
|
22
|
+
|
|
23
|
+
### `find_lcsc_parts` — 按需求找料
|
|
24
|
+
|
|
25
|
+
把「用料需求」变成按综合性价比排序的候选:单价(按实际采购量取档)、库存覆盖、参数匹配、基础库优先。
|
|
26
|
+
|
|
27
|
+
| 参数 | 默认 | 说明 |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `need` | 必填 | 中文或英文:类别 + 封装 + 参数;也接受型号或 LCSC 编号 |
|
|
30
|
+
| `assembly` | `hand` | `hand` 手焊 / `smt` 嘉立创贴片(扩展库计上料费) |
|
|
31
|
+
| `quantity` | 1 | 每板用量 |
|
|
32
|
+
| `boards` | 1 | 打板数量(决定价格档与上料费摊销) |
|
|
33
|
+
| `sort` | `balanced` | `balanced` / `cost` / `stock` |
|
|
34
|
+
| `limit` | 5 | 返回条数 1–8 |
|
|
35
|
+
| `include_cny` | hand 时 true | 尝试取立创国内站人民币价 |
|
|
36
|
+
| `exclude_lcsc` | — | 排除的料号(找替代料用) |
|
|
37
|
+
|
|
38
|
+
### `audit_lcsc_bom` — BOM 体检
|
|
39
|
+
|
|
40
|
+
CSV / TSV / JSON 行入,逐行给出价格(USD 阶梯,按采购量取档)、库存、基础库/扩展库;SMT 模式下计扩展库上料费,并给扩展库料推荐基础库替代。
|
|
41
|
+
|
|
42
|
+
| 参数 | 默认 | 说明 |
|
|
43
|
+
|---|---|---|
|
|
44
|
+
| `bom` | 必填 | CSV/TSV 文本(表头可选,中英文均可)或 `[{"lcsc":"C1581","qty":5}]` |
|
|
45
|
+
| `assembly` | `hand` | `hand` 不计上料费 / `smt` 计 $3/唯一料号/单 |
|
|
46
|
+
| `boards` | 1 | 打板数量 |
|
|
47
|
+
| `include_cny` | false | 额外尝试人民币零售价(best effort,限 10 个料号) |
|
|
48
|
+
| `suggest_alternatives` | true | 为扩展库料推荐基础库替代(仅 smt) |
|
|
49
|
+
|
|
50
|
+
输出除 `rows` / `summary` 外还有:
|
|
51
|
+
|
|
52
|
+
- `summary.lines_in_bom`、`summary.skipped_lines` + `skipped[]`:**没有 LCSC 编号的行不会被静默丢弃**,逐行给出位号与名称
|
|
53
|
+
- 每行 `stock_source` / `price_source`:该行的价格与库存分别取自哪个仓库
|
|
54
|
+
- `summary.library_unknown`:查得到但不在嘉立创 SMT 库里的料
|
|
55
|
+
|
|
56
|
+
> `skipped_lines > 0` 表示总价一定偏低——缺的料没算进去。
|
|
57
|
+
|
|
58
|
+
## 数据口径
|
|
59
|
+
|
|
60
|
+
| 仓库 | 用途 | 数据源 |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| 嘉立创 SMT 备料仓 | 贴片打样价格 + 库存 | JLCPCB SMT 元件接口 |
|
|
63
|
+
| 立创国际站 lcsc.com | 零售阶梯价、国际仓库存 | 商品页 |
|
|
64
|
+
| 立创国内站 item.szlcsc.com | 人民币零售价(best effort) | EasyEDA → 商品页 |
|
|
65
|
+
|
|
66
|
+
- **USD 与 CNY 从不互相换算**:有真实人民币价才给 `unit_cny`,否则给 `unit_cny_estimate` 并标注「估算参考」。
|
|
67
|
+
- `assembly=smt`:价格与库存都取嘉立创 SMT 备料仓。
|
|
68
|
+
- `assembly=hand`:价格取立创零售阶梯价,库存取可验证来源,行内标注来源。
|
|
69
|
+
|
|
70
|
+
## 配置
|
|
71
|
+
|
|
72
|
+
在 profile 的 `cordis.patch.yml` 里覆盖:
|
|
73
|
+
|
|
74
|
+
```yaml
|
|
75
|
+
- id: lcsc-parts
|
|
76
|
+
config:
|
|
77
|
+
timeoutMs: 8000
|
|
78
|
+
retries: 3
|
|
79
|
+
cacheTtlMs: 600000
|
|
80
|
+
usdToCnyFactor: 6.0
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 局限(无法消除)
|
|
84
|
+
|
|
85
|
+
1. **价格本质是美元 SMT 元件阶梯价**,不是立创商城零售价——两套体系,不换算。
|
|
86
|
+
2. **人民币价链路脆弱**:国内站经 EasyEDA 跳转,可能整体 0 覆盖,此时人民币只有估算。
|
|
87
|
+
3. **6.0 是标定系数,不是汇率**,不区分品类;可在配置里调。
|
|
88
|
+
4. **三个仓库三种库存**:立创国际站的库存不等于国内仓库存,不能互相冒充。
|
|
89
|
+
5. **没有 LCSC 编号的料算不出价格**——插件不做自动选型猜测。
|
|
90
|
+
6. **价格/库存是快照**;上料费只含 $3/唯一料号/单,不含工程费、钢网费、焊点费、加急费;「优选扩展库」分类未公开,可能高估。
|
|
91
|
+
7. **替代料只做保守同类替换**(同类别、同封装、基础库、有库存),不做电气/热/寿命/认证等效验证。
|
|
92
|
+
|
|
93
|
+
## 许可
|
|
94
|
+
|
|
95
|
+
MIT
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Bundle patch for dsh-plugin-lcsc (Host-only bundle).
|
|
2
|
+
# `install_bundle` adds the package dependency and selects this bundle; this
|
|
3
|
+
# patch inserts the plugin row into the profile's composed plugin tree.
|
|
4
|
+
- insert:
|
|
5
|
+
- id: lcsc-parts
|
|
6
|
+
name: 'dsh-plugin-lcsc'
|
|
7
|
+
config:
|
|
8
|
+
timeoutMs: 8000
|
|
9
|
+
retries: 3
|
|
10
|
+
cacheTtlMs: 600000
|
|
11
|
+
usdToCnyFactor: 6.0
|