dsh-plugin-lcsc 0.3.1 → 0.3.2

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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > 立创商城 / 嘉立创选料与 BOM 体检,为 DeepSeek Harness 提供 **2 个工具**。
4
4
  > 默认面向**国内手焊 DIY**:给真实人民币价 + 国内库存;也支持嘉立创 SMT 的 $3/扩展库上料费核算。
5
5
 
6
- 当前版本 **0.3.1**(npm 上最新发布版本以 npm 页面为准)。
6
+ 当前版本 **0.3.2**(npm 上最新发布版本以 npm 页面为准)。
7
7
 
8
8
  只暴露 2 个工具,不挤占模型上下文。
9
9
 
package/data.js CHANGED
@@ -582,6 +582,11 @@ export function parseBomCsvDetailed(text) {
582
582
  const rest = row.filter((cell) => !/^C\d{4,11}$/i.test(cell.trim()))
583
583
  let qty = 1
584
584
  let designators
585
+ let place
586
+ // Headerless rows may be `code,qty,place` — recognise the placement token so
587
+ // it is not mistaken for a designator (and DNP/hand rows stay separate).
588
+ const placeCell = rest.find((cell) => /^(smt|hand|dnp|不贴|手焊|手工|贴片|机贴|mount)$/i.test(cell.trim()))
589
+ if (placeCell !== undefined) place = placeCell.trim()
585
590
  for (const cell of rest) {
586
591
  const integer = Number(cell)
587
592
  if (Number.isInteger(integer) && integer > 0 && cell.trim() !== '') {
@@ -590,12 +595,13 @@ export function parseBomCsvDetailed(text) {
590
595
  }
591
596
  }
592
597
  for (const cell of rest) {
598
+ if (cell === placeCell) continue
593
599
  if (cell.trim() !== '' && !Number.isFinite(Number(cell)) && !/C\d{4,11}/i.test(cell)) {
594
600
  designators = cell.trim()
595
601
  break
596
602
  }
597
603
  }
598
- rows.push(clean({ line: index + 1, code, qty, designators }))
604
+ rows.push(clean({ line: index + 1, code, qty, designators, place }))
599
605
  }
600
606
  return { rows, skipped }
601
607
  }
package/index.js CHANGED
@@ -1817,9 +1817,10 @@ export async function auditBom(service, args, options = {}) {
1817
1817
  verified: auditRows.filter((row) => row.status === 'verified').length,
1818
1818
  no_stock: auditRows.filter((row) => row.status === 'NO-STOCK').length,
1819
1819
  not_found: auditRows.filter((row) => row.status === 'NOT-FOUND').length,
1820
- base_parts: smtRows.filter((row) => row.library === 'base').length,
1821
- expand_parts: extendedUnique.size,
1822
- library_unknown: smtRows.filter((row) => row.library === undefined).length,
1820
+ base_parts: costRows.filter((row) => row.library === 'base').length,
1821
+ expand_parts: new Set(costRows.filter((row) => row.library === 'expand').map((row) => row.lcsc)).size,
1822
+ expanded_fee_parts: extendedUnique.size,
1823
+ library_unknown: costRows.filter((row) => row.library === undefined).length,
1823
1824
  extended_fee_per_order_usd: money(extendedFee),
1824
1825
  setup_fee_usd: money(setupFeeUsd),
1825
1826
  stencil_fee_usd: money(stencilFeeUsd),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-lcsc",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Requirement-driven LCSC/JLC part finder and BOM cost auditor for DeepSeek Harness agents: real CNY+USD dual pricing, basic-vs-extended library fees, DNP/hand placement, net-saving alternatives",
5
5
  "keywords": [
6
6
  "dsh-plugin",