dda793c0ef
- Introduced `kicad_cli.sh` for local and Docker-based kicad-cli execution. - Created `schops.py` for schematic operations including ERC, BOM, netlist exports, and bulk edits. - Added README.md for schops with installation and usage instructions. - Included requirements.txt for necessary Python packages. - Implemented rules engine for applying field defaults and renaming nets. - Added tests for rules engine functionality. - Introduced scope guard script to enforce file modification policies based on PR labels. - Created watch script to monitor KiCad files and trigger hardware gate on changes.
36 lines
1.1 KiB
Bash
36 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Hardware gate:
|
|
# - auto-detect first schematic + pcb under provided root (default: hardware/kicad)
|
|
# - export previews (SVG) + reports (ERC/DRC/BOM/netlist) to artifacts
|
|
# - lint design blocks + regenerate blocks registry
|
|
|
|
ROOT_DIR="${1:-hardware/kicad}"
|
|
|
|
if [[ ! -d "${ROOT_DIR}" ]]; then
|
|
echo "ERROR: ${ROOT_DIR} not found" >&2
|
|
exit 2
|
|
fi
|
|
|
|
SCHEM="$(find "${ROOT_DIR}" -name "*.kicad_sch" -maxdepth 4 | head -n 1 || true)"
|
|
PCB="$(find "${ROOT_DIR}" -name "*.kicad_pcb" -maxdepth 4 | head -n 1 || true)"
|
|
|
|
if [[ -z "${SCHEM}" && -z "${PCB}" ]]; then
|
|
echo "No .kicad_sch or .kicad_pcb found under ${ROOT_DIR} (nothing to do)."
|
|
exit 0
|
|
fi
|
|
|
|
echo "Using schematic: ${SCHEM:-<none>}"
|
|
echo "Using pcb: ${PCB:-<none>}"
|
|
|
|
OUTDIR="$(python tools/hw/exports.py ${SCHEM:+--schematic "$SCHEM"} ${PCB:+--pcb "$PCB"})"
|
|
echo "Previews: ${OUTDIR}"
|
|
|
|
python tools/hw/blocks/lint_blocks.py --blocks-dir hardware/blocks
|
|
python tools/hw/blocks/generate_registry.py --blocks-dir hardware/blocks --out hardware/blocks/REGISTRY.md
|
|
|
|
python tools/compliance/validate.py
|
|
|
|
echo "OK"
|