From e460f2d085b6a4bbba16699f86a1e0a7f829976b Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 17 Jul 2026 08:51:19 +0000 Subject: [PATCH] schlib_write: write ComponentDescription alongside SOP parameters (by admin) --- SKILL.md | 128 ++++++----- assets/CHANGELOG.xlsx | Bin 5668 -> 5670 bytes assets/template/Type_ID.xlsx | Bin assets/vecmocon-logo.png | Bin references/description_format.md | 350 ++++++++++++++++--------------- references/schlib_parameters.md | 32 ++- references/taxonomy.md | 0 scripts/.__wtest | 1 + scripts/altium_params.py | 0 scripts/altium_refs.py | 0 scripts/append_parameter.py | 0 scripts/common.py | 0 scripts/fill_templates.py | 0 scripts/gitea_components.py | 0 scripts/push_to_gitea.sh | 0 scripts/schlib_write.py | 59 +++++- 16 files changed, 330 insertions(+), 240 deletions(-) mode change 100755 => 100644 SKILL.md mode change 100755 => 100644 assets/template/Type_ID.xlsx mode change 100755 => 100644 assets/vecmocon-logo.png mode change 100755 => 100644 references/description_format.md mode change 100755 => 100644 references/schlib_parameters.md mode change 100755 => 100644 references/taxonomy.md create mode 100644 scripts/.__wtest mode change 100755 => 100644 scripts/altium_params.py mode change 100755 => 100644 scripts/altium_refs.py mode change 100755 => 100644 scripts/append_parameter.py mode change 100755 => 100644 scripts/common.py mode change 100755 => 100644 scripts/fill_templates.py mode change 100755 => 100644 scripts/gitea_components.py mode change 100755 => 100644 scripts/push_to_gitea.sh mode change 100755 => 100644 scripts/schlib_write.py diff --git a/SKILL.md b/SKILL.md old mode 100755 new mode 100644 index f76b0a5..e96c62d --- a/SKILL.md +++ b/SKILL.md @@ -2,15 +2,16 @@ name: library-manager description: >- Manage Vecmocon's component library. Extract parameters from a component datasheet PDF into the - per-typeid Excel template. Checks Gitea for a duplicate MPN_make, classifies to a typeid, updates that typeid's template (versioning, changelog, backfill), fills - a per-part workbook with human verification, reads the Altium symbol/footprint refs, assembles - a part folder and pushes to Gitea. Can UPDATE an existing part instead of hard-stopping, and can - WRITE the mandatory SOP parameters directly into a .SchLib symbol while stripping Ultra-Librarian - defaults. On the .SchLib task it also fills that component's Excel (Description + all parameters) - and pushes the updated symbol to Gitea, no verification loop. Descriptions - follow Vecmocon's strict Altium Description Format. Use whenever the user uploads a datasheet, - builds/updates a library entry, adds a template parameter, fills/updates .SchLib parameters, or - pushes a part to Gitea. Always trigger on "\datasheet", "\library", "\library-manager", "\schlib". + per-typeid Excel template. Checks Gitea for a duplicate MPN_make, classifies to a typeid, updates + that typeid's template (versioning, changelog, backfill), fills a per-part workbook with human + verification, reads the Altium symbol/footprint refs, assembles a part folder and pushes to Gitea. + Can UPDATE an existing part instead of hard-stopping. ALWAYS WRITES the mandatory SOP parameters + into the .SchLib symbol (stripping Ultra-Librarian defaults) as a required step of every run + involving a symbol — never asks first. On the .SchLib task it also fills that component's Excel + and pushes, no verification loop. Descriptions follow Vecmocon's strict Altium Description Format. + Use whenever the user uploads a datasheet, builds/updates a library entry, adds a template + parameter, fills/updates .SchLib parameters, or pushes a part to Gitea. Always trigger on + "\datasheet", "\library", "\library-manager", "\schlib". --- # Library Manager @@ -41,15 +42,18 @@ own, without asking for confirmation**. Never add a "shall I push?" step — jus the user where it landed. (You still flag a genuine symbol/footprint mismatch, because that's a correctness issue, not a push confirmation.) -**Symbol parameters are a second exception — stamp them without asking, every time.** This -holds in both directions. As a standalone task (the engineer hands over a `.SchLib`): fill that -component's Excel (Description + all parameters) and push the updated symbol automatically, -without pausing to confirm the values. And **inside the normal new-part flow**: once the symbol -is uploaded at step 6, stamp the SOP + sheet parameters onto it and strip the Ultra-Librarian -defaults as a matter of course — do **not** offer it as a follow-up, do **not** ask whether the -engineer wants it, and never push a part folder whose symbol still carries UL defaults. See -*Mandatory symbol parameters* for why this path skips the loop. Every other flow keeps the -normal interactive asks below. +**The `.SchLib` task is a second exception — it fills and pushes without a verification loop.** +When the engineer hands over a symbol for the schlib flow, fill that component's Excel +(Description + all parameters) and push the updated symbol automatically, without pausing to +confirm the values. See *Mandatory symbol parameters* for why this path skips the loop. + +**Writing symbol parameters is a third exception — always do it, never ask.** Whenever a +`.SchLib` is in play — the standalone schlib task *or* step 6b of a new-part run — filling its +mandatory SOP parameters is a required action, not an offer. Never ask "should I fill the symbol +parameters?" or leave it as a suggested next step; the answer is always yes, so just write them +and report it. A symbol that still holds Ultra-Librarian defaults is an incomplete part. + +Every other flow keeps the normal interactive asks below. ## Inputs @@ -218,23 +222,32 @@ each header's unit. **Leave blanks where the datasheet is silent — an honest b guess.** The **`Description`** column is special: it is **not** free prose but a strict `_`-joined -engineering string — a type prefix, the defining parameters in a fixed order, package near the -end, optional AEC-Q last (e.g. `CHIP_RES_36kΩ_62.2mW_±0.1%_0402`, `CHIP_CAP_2.2uF_100v_±10%_1210_x7r`, -`SCH_100V_0.25A_SOD-323F`). `references/description_format.md` defines the format for **every** -type in the library: the four the Altium SOP spells out (Resistor, Capacitor, Zener, TVS) are -**strict**; the rest are the house extension on the same basis. Look up the part's type there, +engineering string. It **always opens with `Class_TYPEID`** — the part's library Class exactly as +spelled in its repo folder, then its Type ID in upper case — followed by the defining parameters +in a fixed order, package near the end, optional AEC-Q last. E.g. +`Resistor_FIX_36kΩ_62.2mW_±0.1%_0402`, `Capacitor_CER_2.2uF_100v_±10%_1210_x7r`, +`Diode_SCH_100V_0.25A_SOD-323F`, `Diode_TVS_5V_9.2V_18A_SOD-323`. + +This `Class_TYPEID` opening is **mandatory for every part, with no exceptions** — including +Resistor, Capacitor, Zener and TVS, where it deliberately overrides the prefix given in SOP §6. +The old technology prefixes (`CHIP_RES`, `CHIP_CAP`, `TANT_CAP`, `NMOS`, `ZEN`, …) are +**retired** — never emit them. `references/description_format.md` defines the parameter order +for **every** type in the library and is authoritative; read it before writing a Description. +Look up the part's type there, build the Description to that format, and if a real datasheet doesn't fit the format cleanly, follow the pattern and **flag the mismatch to the engineer** rather than bending it silently. Collect the values into a small `part.json`: ```json {"mpn":"BAT46WJ","manufacturer":"Nexperia","typeid":"SCH", - "values":{"Description":"SCH_100V_0.25A_SOD-323F","Forward Voltage(V)":"0.71", + "values":{"Description":"Diode_SCH_100V_0.25A_SOD-323F","Forward Voltage(V)":"0.71", "Reverse Voltage(V)":"100","Forward Current(A)":"0.25","Package":"SOD-323F"}} ``` -(typeid `SCH` → prefix `SCH`, format `SCH_Vr_Io_Package`, so a 100 V / 250 mA Schottky in -SOD-323F becomes `SCH_100V_0.25A_SOD-323F`.) +(typeid `SCH` sits in Class `Diode` → prefix `Diode_SCH`, format `Diode_SCH_Vr_Io_Package`, so a +100 V / 250 mA Schottky in SOD-323F becomes `Diode_SCH_100V_0.25A_SOD-323F`. The Class token is +the repo folder name from `CLASS_FOLDER` in `scripts/common.py`, so the Description's first token +always matches the folder the part is pushed to.) ```bash python scripts/fill_templates.py part.json \ @@ -297,33 +310,40 @@ python scripts/fill_templates.py part.json \ --template assets/template/template.xlsx --dest // --design design.json ``` -Once you have the symbol and its Library Ref, **stamp the mandatory symbol parameters onto the -`.SchLib` — always, automatically, without asking.** This is not an optional extra and it is not -something to offer the engineer: a symbol that reaches Gitea carrying Ultra-Librarian defaults -instead of the SOP set is an incomplete part. Do it in this same run, before step 7, so the -folder is pushed complete the first time. +### 6b. Write the mandatory symbol parameters — always, without asking -Build the parameter set from the datasheet values you already read for the workbook (they are the -same values — Manufacturer, Manufacturer Part, Value, Tolerance, Operating Temperature, RoHS, -Datasheet, Process, Vecmocon Part Code, …), **plus every engineering parameter from this typeid's -sheet** and `Component Type` = the part's Class, then write them in and strip the UL defaults — -see *Mandatory symbol parameters* below for the full set and the exact commands. Skip only the -housekeeping columns (`MPN_make_type`, Skill/Template Version) and the four Library/Footprint -Ref/Path columns — those are Altium's own model links, so duplicating them as parameters would -create two sources of truth. +Once you have the symbol and its Library Ref, **write the mandatory symbol parameters into the +`.SchLib`**. This is **not optional and not a question** — it is a required step of every +new-part run. Do not ask "would you like me to fill the symbol parameters?", do not offer it as +a suggestion, and do not defer it to a later turn. Just do it, then report that it's done. -Don't stop to confirm the values here either; the engineer validates the symbol by opening it in -Altium, which is the real check. Leave genuinely-unknown fields blank (the SOP hides blank -parameters) and **note the gaps in your summary** rather than blocking on a question — the one -field that is never on a datasheet is `Vecmocon Part Code`, so use it if the engineer supplied it -and otherwise leave it blank and say so. +The SOP requires the fixed parameter set (Manufacturer, Manufacturer Part, Value, Tolerance, +Operating Temperature, RoHS, Datasheet, Process, Vecmocon Part Code, …) on every symbol, **plus +the symbol's Description**, so a part folder whose `.SchLib` has not been filled is **incomplete +and must not be pushed**. Build the part's `params.json` from the values the engineer just +verified in step 5 — including `"description"`, set to the **same** strict `Class_TYPEID` string +you put in the part's Excel — and run: + +```bash +python scripts/schlib_write.py \ + --schlib //.SchLib \ + --params params.json \ + --out //.SchLib +``` + +See *Mandatory symbol parameters* below for the full parameter set, the value-shorthand rules, +and the Ultra-Librarian default-stripping behaviour — read `references/schlib_parameters.md` +before building the parameter set. The values are already verified at this point, so this step +inherits no verification loop of its own. ### 7. Assemble the part folder The staging folder `/` should now hold the four files: the per-part `.xlsx`, the -datasheet (name it `_data.`), the symbol (the **stamped** one from step 6, not the raw -upload), and the footprint. If the engineer's upload carried extra files (a `.step` 3D model, a -`.LibPkg`), ask whether to include them — the standard folder is these four. +datasheet (name it `_data.`), the symbol, and the footprint. + +**Before pushing, check that the symbol has actually been filled** (step 6b). The part folder is +not complete until it has. If the `.SchLib` still carries only Ultra-Librarian defaults, go back +and run `schlib_write.py` — don't push, and don't ask the user whether to; just fill it. ### 8. Push to the library repo, under the part's Class @@ -341,8 +361,15 @@ user where it landed. The SOP (§5) requires every schematic symbol to carry a fixed parameter set in its Altium properties — `Component Type`, `Manufacturer`, `Manufacturer Part`, `Value`, `Tolerance`, `Operating Temperature`, `ROHS`, `Datasheet`, `Process`, `Vecmocon Part Code`, and the two -second-source fields — with the **Comment** set to the MPN. The skill can stamp these onto the -symbol from the datasheet. +second-source fields — with the **Comment** set to the MPN and the **Description** set to the +part's strict `Class_TYPEID` string. The skill stamps all of these onto the symbol from the +datasheet in a single pass. + +**Description is written too, always.** It isn't a parameter — it's the `ComponentDescription` +field in the symbol's header, which Ultra-Librarian ships as the placeholder text `Description`. +So it must be written explicitly or the symbol shows the literal word "Description" in Altium +even when every parameter is right. Pass `"description"` in `params.json` (it falls back to +`parameters.Description`), and use the **same** string as the part's Excel so the two agree. This runs **as its own task too**, not only inside new-part creation: whenever the user hands over one or more `.SchLib` files and wants their parameters filled/updated (e.g. "\schlib", "add @@ -375,7 +402,8 @@ Leave any genuinely-unknown field blank — the SOP hides blank parameters, so a empty until filled. The full method for the second-source search is in `references/schlib_parameters.md`. -Collect the values into a `params.json` and write them into the symbol: +Collect the values into a `params.json` — with `"description"` alongside `"parameters"` — and +write them into the symbol: ```bash python scripts/schlib_write.py --schlib .SchLib --params params.json --out //.SchLib diff --git a/assets/CHANGELOG.xlsx b/assets/CHANGELOG.xlsx index 16a0459f11853d6ba2eb36f73570ace90a314b85..9a87278372af9e0ac10a1ddad439ab3da38dde3b 100644 GIT binary patch delta 2262 zcmY*bdo&Y_8{PNKS4=Vye*Dhq_xpPPdCzms^Stjl?>WzT-cm#vLde0E`+ztA00033(IlZ( zP#~J^&XgOuNE*<%Wvo=NpG?_09EV3VwMQ z%Kb8t<*SgwE{nPjez=aIE3JwtEJBSXn6Q4KUVE8>l8M9g@$4NZH$v(+9z$h+aW%-T zC4I-U-)1=0oi;Vi`8iP&%M(}i~@cQV+H)rj#)t#0{$-+}F(?_QuJLfZiv z^78K=B*jXyvYu=PQo&yipEM9p+$AzDbP2UHAO`+%`75MAV@i%|utztyj z*_0bfvy;VZ8KJ!Q#22WSsW-00~>)P6*B11|y_*NGwEx-;Rt=D&2 zuiu52=TB1caL;8Vl>B~V&UZE=n>x?Dr=BOULsl_{Mswt>y-wOzy-MC*ev2E>XZy6C z`=0xGsRk-5n=3#IY|lHvSlu+c8DjdU2Ivi_4K4Cg>QumiQS{rJ+Vl5CPo*iusLtQF zt@r?XT(R~2qsG(~7be?*c#L!fiPk@qy@gsJb%fFIyt$Vq-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