Skip to content

Latest commit

 

History

History
533 lines (402 loc) · 26.4 KB

CLI_USER_GUIDE.md

File metadata and controls

533 lines (402 loc) · 26.4 KB

WayriCAD CLI User Guide

For complete analysis workflows and command examples, see the Quick PI user guide, Quick SI user guide, and QuickTherm user guide. These explain the inputs and model limits behind each command as well as how to inspect and export its results.

For Blender visualization, use python -m wayricad_runtime.tool_cli blender result.json --output new-scene-folder. The Blender guide explains optional launching, headless .blend creation, supported fields and computed-frame animation.

HTML and PDF reporting covers python -m wayricad_runtime.tool_cli report result.json --html review.html --pdf review.pdf and report-pdf review.html --output review.pdf. Raw JSON stays optional; use --include-raw-evidence with report-pdf only when you want a printed appendix.

Start with the all-tools command catalogue for unified discovery, interpreter checks, multi-net analysis studies and the supported command surface of all 24 source-catalogue plugins. Use wayricad tools list or wayricad tools run TOOL -- --help.

Advanced fanout exposes style/angle choices, family presets, paired breakout settings and selected-netclass dimensions through python -m wayricad_runtime.cli fanout settings. Plans include every bend (path_mm), actual generated length (length_mm) and pair identity (pair_id). See advanced fanout examples and semantics.

The WayriCAD CLI extracts electrical interface data without opening the plugin windows. Use it for repeatable ICD generation, design validation, cross-board linking, continuous integration, and KiCad jobset output pipelines.

For plain-English coordination, use wayricad-assistant --help or wayricad tools run assistant -- --help. The Assistant guide explains command review, required inputs and visual results. Release 3.6.28 includes Assistant as a testing package; interpreted commands still require review.

1. Installation and runtime selection

Install the repository into a normal Python 3.10 or newer environment:

python -m pip install -e .
wayricad --version
wayricad dependencies

Use python -m extract_pins_plugin wherever the wayricad launcher is not on PATH. XML netlist, report, cross-link, validation, and inspection commands do not import pcbnew. board-extract and board-list do require a Python runtime that can import the KiCad pcbnew module.

On Windows, a board command can be launched explicitly with KiCad's Python:

& 'C:\Program Files\KiCad\10.0\bin\python.exe' -m extract_pins_plugin `
  board-extract .\controller.kicad_pcb --refs 'J*' --format csv `
  --output .\artifacts\connector-pins.csv

Run wayricad COMMAND --help for command-specific options. Global options such as --config, --diagnostics, and --quiet must appear before the command.

2. Inputs and deterministic outputs

The additional development-folder tools expose separate local commands after installing the suite:

wayricad-copper --help
wayricad-mechanical --help

Copper Balancer selects a native KiCad 10 interpreter for geometry work. Mechanical Check discovers native KiCad and FreeCAD runtimes. These commands are listed in wayricad capabilities under additional_cli, rather than advertised as JSON-RPC operations. Detailed examples and engine requirements are in the individual plugin READMEs.

Schematic commands accept KiCad XML netlists, .net files, or directories. A directory is searched recursively and all matching inputs are processed in sorted order. Export a compatible netlist with KiCad 10 using:

kicad-cli sch export netlist --format kicadxml \
  --output artifacts/controller.xml controller.kicad_sch

Use --format json for automation, csv for spreadsheet/database import, md or html for review documents, and svg for diagrams. Use --output to write a file; otherwise output is written to stdout. Parent output directories are created automatically.

3. Project inspection

Inspect parsed components, sheets, interfaces, and optional pin rows before building a report:

wayricad inspect exports/ --include-pins \
  --board-sequence DEMO_CTRL,DEMO_SENSOR,DEMO_POWER,DEMO_IO \
  --sheet-alias 'ADCS IMU:/Main/ADCS/*:U*' \
  --format json --output artifacts/project-inventory.json

--sheet-alias has the form Name:path_glob:reference_glob and can be repeated. Native hierarchical sheet paths are preserved even when a friendly alias is applied.

4. Electrical data extraction

The extract command supports six datasets:

Kind Purpose
pins Component, sheet, pin function, net, board endpoint, and TM/TC data
connectors Connector-oriented ICD rows
testpoints Test-point net and resolved function rows
tm-tc TM, TA, TD, TC, CA, and CD signal records
interfaces Consolidated buses, differential pairs, and logical interfaces
controller-map Auditable controller/IC-to-connector paths across exact approved pin pairs

Examples:

wayricad extract exports/controller.xml --kind connectors --format csv \
  --output artifacts/connectors.csv

wayricad extract exports/ --kind tm-tc --consolidate \
  --board-sequence DEMO_CTRL,DEMO_SENSOR,DEMO_POWER,DEMO_IO --format csv \
  --output artifacts/tm-tc.csv

wayricad extract exports/ --kind interfaces --format svg \
  --output artifacts/interfaces.svg

wayricad extract exports/controller.xml --kind controller-map \
  --source-refs U1,U2 --connector-refs J* \
  --path-rule "Q12 | D-S | active | verify MOSFET state" \
  --path-rule "Q20 | C-E | active | verify BJT bias" \
  --include-active-paths --format csv \
  --output artifacts/controller-connector-map.csv

Board endpoint order is inferred from the order of tokens in --board-sequence, not from one rigid label template. TM/TC identifiers are recognized as underscore-delimited tokens.

Controller-map safe defaults cross only two-terminal series resistors, inductors, ferrites, and fuses. Capacitors are excluded because they are normally shunts. MOSFET, BJT, jumper-state, and other IC routes require an exact pin-pair rule plus --include-active-paths; these rows are marked Conditional. Pin tokens may be physical numbers or XML netlist pin functions. Use --path-rules-file for reviewed team rules, --exclude-ambiguous for a strict publication artifact, and --max-hops/--max-paths as traversal bounds. Source and connector indicate reporting scope only; WayriCAD does not infer semiconductor state or electrical direction.

5. Cross-project and harness linking

crosslink imports WayriCAD CSV or Markdown pin documents. It first applies exact and normalized net matching, then any supplied wildcard or regular-expression rules. Power links are excluded unless --include-power is present.

wayricad crosslink demo_ctrl-pins.csv demo_sensor-pins.md \
  --project DEMO_CTRL --project DEMO_SENSOR \
  --rules-file docs/examples/crosslink.rules.txt \
  --format json --output artifacts/cross-links.json

wayricad crosslink demo_ctrl-pins.csv demo_sensor-pins.md \
  --project DEMO_CTRL --project DEMO_SENSOR \
  --rules 'Board prefix | wildcard | DEMO_CTRL_* | DEMO_SENSOR_*' \
  --format svg --output artifacts/harness.svg

Keep rule files under version control. Review ambiguous one-to-many links before using the result as a harness definition.

Explicit harness pin maps

The Harness Workbench accepts non-corresponding and one-to-many pin mappings. Create a CSV with the endpoint columns below; optional columns carry wire construction metadata.

source_project,source_connector,source_pin,destination_project,destination_connector,destination_pin,wire_id,gauge_awg,color,bundle,splice,length_m,shield,notes
DEMO_CTRL,J1,1,DEMO_IO,J7,8,W00001,24,Blue,DATA,,1.25,,Transmit
DEMO_CTRL,J1,2,DEMO_IO,J7,12,W00002,24,White,DATA,,1.25,,Receive

To include full board-internal paths, first export a Controller Map CSV from Pin Extractor for each board. The file stem, or an optional Project column, must match the project name in the board pin document. These maps retain ordered net segments, series passives, and explicitly authorized conditional active-device crossings.

Build the reviewed harness and offline interactive report through the machine-control API:

{"jsonrpc":"2.0","id":"harness-1","method":"harness.build","params":{"documents":["demo_ctrl.csv","demo_io.csv"],"mapping_csv":"harness-map.csv","path_documents":["DEMO_CTRL.csv","DEMO_IO.csv"],"source_refs":"U1,U2","destination_refs":"U*","include_partial":true,"include_html":true,"title":"Demo System Harness","auto_match":false}}
wayricad run --request harness-request.json --output artifacts/harness-result.json

The response includes the wire list, pin map, net map, ordered system paths, procurement BoM, validation findings, and optionally the complete standalone HTML report in html. Write that field to an .html artifact without modifying it. The report has an interactive five-stage IC/connector/bundle/connector/IC canvas, path details, bundle and status filters, search, sortable tables, and no runtime network dependency. Explicit mappings never assume that connector pins match.

source_refs and destination_refs are comma-separated wildcards. A missing board-side path can be emitted as an Incomplete connector-only row when include_partial is true. An endpoint intentionally excluded by a wildcard is not emitted. Conditional MOSFET, BJT, jumper, and IC transitions remain Conditional in the system result; the harness stage never infers device state.

6. Validation and CI gates

validate emits deterministic diagnostics and returns exit code 3 when a required rule fails:

wayricad --diagnostics json validate exports/ \
  --board-sequence DEMO_CTRL,DEMO_SENSOR \
  --require-tm-consumer --require-tc-origin \
  --format json --output artifacts/wayricad-validation.json

Useful pipeline stages are:

  1. Export kicadxml from the schematic with kicad-cli.
  2. Run KiCad ERC and PCB DRC.
  3. Run wayricad validate as an interface-contract gate.
  4. Generate the ICD and machine-readable pin tables.
  5. Publish the entire artifact directory.

GitHub Actions example:

- name: Install WayriCAD
  run: python -m pip install -e .
- name: Export KiCad netlist
  run: kicad-cli sch export netlist --format kicadxml --output artifacts/design.xml design.kicad_sch
- name: Validate interfaces
  run: wayricad --diagnostics json validate artifacts/design.xml --board-sequence DEMO_CTRL,DEMO_SENSOR --require-tm-consumer --require-tc-origin --format json --output artifacts/validation.json
- name: Build ICD
  run: wayricad report artifacts/design.xml --board-sequence DEMO_CTRL,DEMO_SENSOR --format html --output artifacts/electrical-icd.html

The same commands work in GitLab CI, Jenkins, Azure Pipelines, Make, Ninja, or a PowerShell build script. Avoid shell redirection for structured output; use --output so failures and diagnostics remain separate from the generated file.

7. Configuration files

Pass --config before the command. The JSON object can contain shared defaults and command-specific keys. Explicit non-empty CLI values win.

wayricad --config docs/examples/wayricad.config.json extract exports/ \
  --kind tm-tc --output artifacts/tm-tc.csv

Option names use underscores in JSON, for example board_sequence, sheet_alias, include_power, and consolidate.

8. KiCad jobset integration

KiCad 9 and later can run .kicad_jobset files in the Project Manager or with kicad-cli. WayriCAD supports two integration patterns.

Run a native jobset through WayriCAD

wayricad jobset-run controller.kicad_pro --file release.kicad_jobset \
  --stop-on-error

wayricad jobset-run controller.kicad_pro --file release.kicad_jobset \
  --destination Manufacturing

wayricad jobset-run controller.kicad_pro --file release.kicad_jobset \
  --dry-run

The destination may be its unique description or ID. jobset-run uses the native kicad-cli jobset run implementation; it does not rewrite the jobset. Executable discovery order is --kicad-cli, KICAD_CLI, PATH, then standard KiCad 10/9 installation locations.

Add WayriCAD as an Execute Command job

In the KiCad Jobset editor:

  1. Add a Schematic: Export Netlist job using kicadxml format. Name its output electrical.xml.
  2. Add a Special: Execute Command job after the netlist job.
  3. Configure non-zero exit codes to fail the job.
  4. Use this command:
wayricad report "${JOBSET_OUTPUT_WORK_PATH}/electrical.xml" --board-sequence DEMO_CTRL,DEMO_SENSOR --format html --output "${JOBSET_OUTPUT_WORK_PATH}/electrical-icd.html"

Add another Execute Command job for validation:

wayricad --diagnostics json validate "${JOBSET_OUTPUT_WORK_PATH}/electrical.xml" --board-sequence DEMO_CTRL,DEMO_SENSOR --require-tm-consumer --require-tc-origin --format json --output "${JOBSET_OUTPUT_WORK_PATH}/interface-validation.json"

KiCad generates destination files in a temporary work directory before moving them into the final folder or archive. Therefore, Execute Command jobs must use ${JOBSET_OUTPUT_WORK_PATH} when reading an earlier job's output or creating a file that must be included in the destination. Job ordering matters.

For reproducible team use:

  • Commit the .kicad_jobset, WayriCAD config, and cross-link rules together.
  • Use paths relative to the project or jobset work directory.
  • Pin the WayriCAD revision in CI.
  • Ensure wayricad is on the environment inherited by KiCad. If it is not, use an absolute virtual-environment launcher or python -m extract_pins_plugin.
  • Do not edit .kicad_jobset JSON by hand; configure and save it with KiCad.

The native command equivalent is:

kicad-cli jobset run --stop-on-error --file release.kicad_jobset controller.kicad_pro

See the KiCad 10 CLI jobset documentation for native destination behavior and options.

9. Reports and documentation bundles

Create one complete interface control document:

wayricad report exports/ --title 'DEMO_CTRL Electrical ICD' \
  --board-sequence DEMO_CTRL,DEMO_SENSOR,DEMO_POWER,DEMO_IO \
  --imports demo_ctrl-pins.csv demo_sensor-pins.csv \
  --rules-file docs/examples/crosslink.rules.txt \
  --format html --output artifacts/demo_ctrl-icd.html

report supports Markdown, HTML, CSV, JSON, and SVG. CSV report output contains the TM/TC table; use individual extract commands when separate connector, test-point, pin, and interface CSV files are required.

10. Plugin automation and external controllers

wayricad capabilities returns a deterministic inventory of all WayriCAD plugins, their actions, input type, and whether mutating actions exist. This lets a workflow engine discover the suite without scraping help text.

Version 3.2 lists 16 active packages. Decoupling is integrated into Quick PI; return-path and test-point tools are integrated into Quick SI. Existing JSON-RPC analysis method names remain compatible; the retired standalone package names are no longer entries in the active package inventory.

wayricad capabilities --output artifacts/wayricad-capabilities.json

For one operation, use wayricad run --request FILE. For a long-lived controller, use wayricad serve --stdio. The server reads one JSON-RPC 2.0 object per line and writes one response per line, flushing after every response:

{"jsonrpc":"2.0","id":1,"method":"capabilities"}
{"jsonrpc":"2.0","id":2,"method":"signal-integrity.i2c-pullup","params":{"voltage_v":3.3,"capacitance_pf":200,"rise_time_ns":300,"sink_current_ma":3}}

This NDJSON subprocess contract works with Doki-style container runners, CI agents, desktop automation, and custom Python/Node/Go controllers. Keep stdin and stdout reserved for protocol messages; diagnostics belong on stderr.

Currently callable headless operations are reported in the operations array. The capability inventory also exposes GUI/board actions so controllers can identify them, but a listed action is not callable through JSON-RPC until its fully qualified operation appears in that array. Board changes require KiCad's Python runtime and must use explicit apply semantics; discovery and analysis do not modify project files.

JSON-RPC errors use standard codes: -32700 parse error, -32601 unknown method, -32602 invalid parameters, and -32000 backend failure.

11. Exit codes and diagnostics

Code Meaning
0 Command completed successfully
1 Runtime, dependency, or native jobset execution failure
2 Invalid arguments, missing input, or unavailable executable
3 Validation completed and found a gating error

Diagnostics go to stderr. --diagnostics json is recommended for CI log collectors. --quiet suppresses non-error diagnostics but never hides errors.

12. Troubleshooting and limitations

  • No XML inputs found: export a kicadxml netlist; a .kicad_sch file is not itself a CLI parser input.
  • pcbnew unavailable: use KiCad's bundled Python for board commands.
  • kicad-cli not found: set KICAD_CLI or pass --kicad-cli.
  • Jobset command works in a terminal but not KiCad: use an absolute launcher path because the GUI may inherit a different PATH.
  • Jobset report is absent from an archive: write it under ${JOBSET_OUTPUT_WORK_PATH} and place the Execute Command job before the destination is finalized.
  • Unexpected links: disable exact or normalized matching and use explicit reviewed rules; power links are opt-in.
  • Board output differs from schematic output: board commands inspect the saved .kicad_pcb; save the editor state before automation.

WayriCAD's first-order electrical estimates and inferred interface direction are review aids. They do not replace ERC/DRC, a field solver, TDR measurement, or an approved interface-control review.

Routing, BOM and design assets in 3.0.0

wayricad-route (or python -m wayricad_runtime.cli) provides fanout and stitching plan/apply commands. Use KiCad 10 Python for board-file operations. Plan writes JSON and optional SVG; apply rechecks the board and candidate geometry and requires a new output filename. See docs/examples/fanout.json and docs/examples/via-in-pad.json for configurations. Net-class and layer selections use the same planner as the GUI.

wayricad-route fanout settings also lists ordered group rules and an example.

Guard stitching uses the same plan/apply flow. Save this as guard.json, replacing the signal and guard names with exact board nets:

{"mode":"Guard selected routes","net_choice":"GND","guard_nets":["CLK","DATA"],"guard_side":"Both","spacing":2.0,"guard_offset":1.0,"diameter":0.6,"drill":0.3,"clearance":0.2}
wayricad-route stitching plan --board board.kicad_pcb --settings guard.json --output guard-plan.json --svg guard-preview.svg
wayricad-route stitching apply --board board.kicad_pcb --plan guard-plan.json --output guarded.kicad_pcb

Dimensions are millimetres. guard_offset is track-centre to via-centre; guard_tracks can additionally contain exact track UUIDs. The guard net must differ from every signal net. Arcs are rejected, not approximated into fences. Apply rechecks inputs and creates a new board with its project/custom-rule companions; existing output files are preserved. Refill zones and run native DRC on the copy. Filled guard copper on one layer does not establish a useful through-via connection on another layer. See the guard workflow. Groups match net, netclass, ref and pad inside the global scope; the first matching group supplies geometry overrides. Set unmatched to defaults, skip or error. Plan output retains group_summary, unmatched_count and skipped_count so automation can detect incomplete selections.

Verify the saved board before planning and the new board after applying:

wayricad-route verify --board original.kicad_pcb --output baseline-drc.json
wayricad-route verify --board routed.kicad_pcb --output routed-drc.json --baseline baseline-drc.json

Verification works with ordinary Python and an installed kicad-cli; it does not import pcbnew. Use --kicad-cli PATH or KICAD_CLI for an explicit executable and --timeout 120 to bound the run. It refills zones in memory, runs native PCB DRC without saving the board, writes the native JSON report, and prints a JSON verdict with counts and source/report hashes. Schematic parity is not requested. Exit codes are 0 accepted, 1 rejected and 2 input/engine/output failure; failures also print a JSON error object.

Without a baseline, errors or unconnected items reject the result. With a baseline, new errors or unconnected items reject it; existing findings remain visible and clean remains false. Warnings are reported without blocking acceptance. Comparison ignores ordering and item UUIDs, retains geometry and descriptions, and requires compatible engine versions and report settings. Acceptance is a DRC check, not signal-integrity or manufacturing approval.

python -m embed_3d_plugin --help lists asset scanning, embedding, extraction, relinking and recovery commands. Writes require --apply. From the Analytics Studio source directory, python -m bomstudio --help exposes native BOM export and workspace tools. These CLI modules do not require a browser.

Trace, via and plane estimates

wayricad-rlc (or python -m trace_impedance_plugin.cli) provides inspect, path and zone operations using KiCad 10's native Python. inspect --net lists actual endpoints and filled-island IDs; path follows connected trace/zone/via geometry; zone estimates a terminal corridor and plane overlap. Auto reference detection checks both ground-net names and copper coverage. Reports are read-only JSON, including source hashes and per-section status.

This command has its own exit codes: 0 resolved, 1 input/runtime error, 2 disconnected or invalid command syntax, 3 partial model. Partial results must not be treated as a complete RLC extraction. See the RLC guide for examples and assumptions.

Embed3D and Quick PI

wayricad-library localize-project board.kicad_pcb previews symbols, footprints and models in the project-local local/ folder. Use --library-folder to change it, --model-root and --var NAME=FOLDER for explicit dependencies, and --apply after saving/closing editors. restore-local BACKUP --apply checks backup and published-file hashes.

Quick PI runs local layered DC conduction and produces native views or offline reports:

wayricad-pi board.kicad_pcb
wayricad-pi board.kicad_pcb --net VCC --source J1.1 --sink U8.2 --voltage 3.3 --current 1 --html pi.html
wayricad-pi board.kicad_pcb --command "run pi C1.1 L1.1 5mH+30m L1.2 U8.2" --voltage 3.3 --current 1 --html series.html

The native window's console accepts help, nets, pads [net], and the same run pi paths. Enter runs a command; Tab completes net/pad names; Up/Down recalls history. Quotes preserve spaces in net names. Unbroken paths accept run pi NET START END or infer the net with run pi START END. Series triplets can repeat: START R1.1 5m R1.2 L1.1 5mH+30m L1.2 END. Each copper section must share an actual net; each component joins two distinct pads of that component.

SI prefixes are case-sensitive: m is milli, M/Meg mega, u/µ/μ micro; scientific notation and Ω/ohm/H units are accepted. A bare 5m is 5 mΩ. 5mH+30m is 5 mH plus 30 mΩ. Values are explicit models, not automatic guesses from the component name. The DC solve reports conductor/component losses separately; inductance stores energy and contributes zero steady-state DC voltage drop.

--mesh-edge controls mesh size in mm, --plating gives barrel plating in mm, and --pulse, --ambient, --temperature and --temperature-limit set the electrical/adiabatic screening assumptions. Numerical conservation is checked separately from mesh convergence. Neither the RLC approximations nor Quick PI claim AC full-wave or fuse-opening-time signoff.

Quick SI protocol suites

wayricad-si profiles lists 33 interface profiles. wayricad-si suite --profile uart --reports route.json --html suite.html evaluates saved Quick SI evidence without KiCad. See protocol suites for pair/bus assignments, explicit budgets, return-path uncertainty, examples and exit codes.

Jobset sequences and automatic reports

Use wayricad jobs init Example.kicad_pro --preset fabrication, then wayricad jobs run --config wayricad-jobs.json --keep-going. For native KiCad integration, generate a .kicad_jobset with wayricad jobs jobset --config wayricad-jobs.json --output WayriCAD.kicad_jobset. See the complete jobset guide for presets, existing-sequence insertion, automatic HTML/JSON reports, runtimes and failure handling.

Copper layer counters

Use KiCad 10's native Python with python -m layer_counter_plugin.cli board.kicad_pcb --style row --layers L1,L2,L4 for read-only JSON. Add --output candidate.kicad_pcb to write a new board with grouped copper labels and a zone-only keepout. Existing destinations are rejected and source project/rule companions are preserved. The installed wheel also exposes wayricad-layer-counter. See Layer Counter for core-pair mapping, styles and fabrication limitations.

IBIS circuit export

wayricad-si ibis-catalog vendor.ibs --output catalog.json lists components, pins, selectors, compatible source/receiver models and the reviewed file SHA-256. Bind those exact choices in an assignment document, then use wayricad-si circuit study.json --assignments assignments.json --case channelA --output new-circuit. Repeat --case for multiple selected paths. The output directory must be new. The bundle includes native schematic sheets, project simulation settings, unchanged vendor model copies, a provenance manifest and clipboard.txt for KiCad. The GUI's Copy circuit writes that same flat clipboard format. See the SI guide and example for model hashes, timing, complete-topology checks and explicit via/copper assumptions. This exports a circuit for KiCad's simulator; it does not replace Quick SI's ideal eye model with a native internal IBIS solver.