### First-run setup modal UI mockup Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-09-12-fresh-install-plan.md ASCII mockup of the first-run setup modal content, showing the options for indexing files, PDF text extraction, auto-binding boards, downloading OpenBoardData, and re-indexing on start. The modal is triggered by server state and includes Skip and Start buttons. ```text Set up your library /library · Big, Samples ───────────────────────────────────────────────────────────────────────────── Index files starts now, ≈200 files/s, everything depends on it PDF text starts by itself after the files are in, runs in the background — nothing to click ☑ Link boards to their PDFs automatically (auto_bind) ☑ Download OpenBoardData — 109 boards, ~2 min, (obd fetch-all) community data under ODbL, from openboarddata.org ☑ Re-index on every start (auto_scan) [Skip for now] [Start] ``` -------------------------------- ### Net listing example in nets.asc Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BDV_ASC_FORMAT.md Example of a net header and its member pins in the nets.asc file. ```text #1 (S) DVDD33 C4529.1 U4501.8 ``` -------------------------------- ### Install release tools and create multiarch builder Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/RELEASE_RUNBOOK.md Installs minisign, lftp, jq, and docker via Homebrew, then creates a Docker buildx builder for multi-architecture builds. The `|| true` prevents failure if the builder already exists. ```bash brew install minisign lftp jq docker docker buildx create --use --name boardripper-multiarch || true ``` -------------------------------- ### Playwright test setup and run Source: https://github.com/alexeyinwerp/boardripper/blob/main/src/frontend/README.md Install the Chromium browser for Playwright and run the E2E tests. Note that headless Chromium lacks WebGL adapters, so the PixiJS 'No available adapters' warning is expected. ```bash npx playwright install chromium # first time only npx playwright test ``` -------------------------------- ### Run with Docker Compose Source: https://github.com/alexeyinwerp/boardripper/blob/main/README.md Starts the BoardRipper server using the checked-in compose file, which builds the image from source. Access the app at http://localhost:8081. The ./library directory is mounted and starts empty. ```bash docker compose up -d # the checked-in compose file BUILDS the image from source (build: .) # → http://localhost:8081 ``` -------------------------------- ### BVR3 Example File Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BVR_FORMAT.md Complete example of a BVR3 file with a board outline and a part with two pins. The outline uses OUTLINE_POINTS with coordinates in microns. Pin origins are relative to the part origin. ```text BVRAW_FORMAT_3 OUTLINE_POINTS 0 0 6800000 0 6800000 4200000 0 4200000 0 0 PART_NAME U1900 PART_SIDE T PART_ORIGIN 1234567 2345678 PART_MOUNT SMD PIN_ID 1 PIN_NUMBER 1 PIN_NAME A1 PIN_SIDE T PIN_ORIGIN 0 0 PIN_RADIUS 50 PIN_NET PP3V3_S5 PIN_TYPE 2 PIN_END PIN_ID 2 PIN_NUMBER 2 PIN_NAME A2 PIN_SIDE T PIN_ORIGIN 0 50000 PIN_RADIUS 50 PIN_NET PP5V_S3 PIN_TYPE 2 PIN_END PART_END ``` -------------------------------- ### $HEADER section example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/CAD_FORMAT.md Example of the $HEADER section with version, units, and origin. ```gencad $HEADER GENCAD 1.4 UNITS USER 1000 ORIGIN 0 0 $ENDHEADER ``` -------------------------------- ### PARTS Section Example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BDV_FORMAT.md Example of a component catalogue with two parts (U1 and R1). Each part defines a bounding box and a starting index into the global PINS array. Pin ownership is determined by index ranges. ```text PARTS: 2 U1 100 200 300 400 0 1 R1 500 600 550 650 8 1 ``` -------------------------------- ### Nets section example (NET/N_PROP/N_PIN/N_VIA) Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/MENTOR_NEUTRAL_FORMAT.md Example of a net record group. NET opens the group, N_PROP adds properties, N_PIN defines pins with RefDes-PinName, coordinates, padstack, and layer index, and N_VIA defines vias with from/to layers. Layer indices follow the layer-stack order from PAD VIA/P_SHAPE records. ```text NET /ADT3_ICM N_PROP (NET_TYPE,"DEFAULT_NET_TYPE") N_PIN R611-2 7.157 5.762 r016x020 1 N_PIN U521-41 6.81285 2.9691 r008x080to 1 N_VIA 7.157 5.723 via10 1 8 ``` -------------------------------- ### COMP, C_PROP, and C_PIN example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/MENTOR_NEUTRAL_FORMAT.md Shows a complete component placement with COMP, C_PROP, and C_PIN records. COMP declares placement with 9 fields; C_PROP adds free-form properties; C_PIN places a single pin in world space. ```text COMP B1 3301-001649 bead_core b1608 4.984 7.084 2 270 C_PROP (SUPLECODE,"BLM18PG181SN1") (INSERT_TYPE,"V") (DESC,"BEAD-SMD;180ohm,1608,…") C_PIN B1-1 4.984 7.1096 8 2 270 s029x035 /SPK5_L_P C_PIN B1-2 4.984 7.0584 8 2 270 s029x035 /N$55180 ``` -------------------------------- ### Build Electron wrapper with build-all.mjs Source: https://github.com/alexeyinwerp/boardripper/blob/main/README.md Build the Electron desktop wrapper locally. Run from the project root: first change into the desktop directory and install dependencies, then invoke build-all.mjs with no flags for all platforms, or with --mac or --win to build only that platform. Output goes to desktop/out/ (macOS), desktop/out-legacy/ (macOS legacy), and desktop/out-win/ (Windows). ```bash cd desktop npm install node build-all.mjs # builds macOS universal + legacy + Windows node build-all.mjs --mac # macOS only node build-all.mjs --win # Windows only ``` -------------------------------- ### Development commands Source: https://github.com/alexeyinwerp/boardripper/blob/main/src/frontend/README.md Commands to install dependencies, run the dev server, build for production, and lint the codebase. ```bash npm install npm run dev # http://localhost:5173 npm run build # production build → dist/ npm run lint ``` -------------------------------- ### Run Dev Server for HDR Probe Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-08-04-hdr-focus-glow.md Command to start the development server for the frontend, as part of Step 9. After running this, the user should open the probe page on an HDR display. ```bash cd src/frontend && npm run dev ``` -------------------------------- ### Go test for prompt registration and argument interpolation Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-09-mcp-phase2-harness.md Verifies the MCP server lists prompts 'understand_circuit', 'diagnose', and 'explain', and that getting a prompt with a 'focus' argument interpolates it into the message text. Also checks the message role is 'user', that no 'kb_search' tool is referenced, and that getting 'diagnose' without arguments still returns messages. Run with 'go test ./mcpserver/ -run TestPrompts_ListAndGet -v' expecting failure until prompts.go is implemented. ```go func TestPrompts_ListAndGet(t *testing.T) { deps := &Deps{State: NewState(&fakeConfig{m: map[string]string{"mcp_enabled": "1"}})} srv := New(deps) ctx := context.Background() ct, st := mcp.NewInMemoryTransports() ss, err := srv.mcp.Connect(ctx, st, nil) if err != nil { t.Fatal(err) } defer ss.Close() cl := mcp.NewClient(&mcp.Implementation{Name: "t", Version: "1"}, nil) cs, err := cl.Connect(ctx, ct, nil) if err != nil { t.Fatal(err) } defer cs.Close() lp, err := cs.ListPrompts(ctx, nil) if err != nil { t.Fatal(err) } names := map[string]bool{} for _, p := range lp.Prompts { names[p.Name] = true } for _, want := range []string{"understand_circuit", "diagnose", "explain"} { if !names[want] { t.Fatalf("prompts/list missing %q", want) } } // get with an argument -> the arg is interpolated into the message text. gp, err := cs.GetPrompt(ctx, &mcp.GetPromptParams{Name: "understand_circuit", Arguments: map[string]string{"focus": "PP3V3_G3H"}}) if err != nil { t.Fatal(err) } if len(gp.Messages) == 0 { t.Fatal("no messages") } txt, ok := gp.Messages[0].Content.(*mcp.TextContent) if !ok { t.Fatalf("message content is %T, want *TextContent", gp.Messages[0].Content) } if !strings.Contains(txt.Text, "PP3V3_G3H") { t.Fatalf("focus arg not interpolated: %s", txt.Text) } if gp.Messages[0].Role != "user" { t.Fatalf("role = %q, want user", gp.Messages[0].Role) } // prompts must not reference the Phase-3 kb_search tool. if strings.Contains(txt.Text, "kb_search") { t.Fatal("prompt references kb_search before Phase 3") } // get with NO argument still returns a valid message (optional arg). gp2, err := cs.GetPrompt(ctx, &mcp.GetPromptParams{Name: "diagnose"}) if err != nil { t.Fatal(err) } if len(gp2.Messages) == 0 { t.Fatal("diagnose returned no messages without arg") } } ``` -------------------------------- ### Placement row example in parts.asc Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BDV_ASC_FORMAT.md Example row from the parts.asc placement list, showing a part with its coordinates, rotation, grid, side, and package names. ```text Part X Y Rot Grid T/B 'Device', 'Outline' PR6001 4.3967 -1.1283 270.0 C3 (T) 'NBS_R0402_H16_000S_B', 'NBS_R0402_H16_000S_B' ``` -------------------------------- ### BRDOUT Section Example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BDV_FORMAT.md Example of a board outline polygon with 4 vertices and dimensions 5000x3000 mils. The first line after BRDOUT is the vertex count and dimensions, followed by vertex coordinate lines. ```text BRDOUT: 4 5000 3000 0 0 5000 0 5000 3000 0 3000 ``` -------------------------------- ### PINS Section Example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BDV_FORMAT.md Example of a global flat array of pin positions. Each pin belongs to the part whose index range covers it. The example shows two pins with coordinates, net indices, and side. ```text PINS: 10 150 250 1 1 200 250 2 1 ... ``` -------------------------------- ### Start BoardRipper container Source: https://github.com/alexeyinwerp/boardripper/blob/main/landing/index.html Command to start the container in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Manual verification commands Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-15-desktop-mcp-backend-sidecar-plan.md Commands to start the desktop app and check the backend process for manual verification of the sidecar behavior. ```bash cd /Users/besitzer/Desktop/Boardviewer/desktop && npm start ``` -------------------------------- ### GenCAD file structure example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/CAD_FORMAT.md Shows the overall layout of a GenCAD file with $HEADER, $SHAPES, $COMPONENTS, and $SIGNALS sections. ```gencad $HEADER GENCAD 1.4 UNITS USER 1000 $ENDHEADER $SHAPES SHAPE QFP48 PIN 1 PAD1 10 20 TOP 0 NO PIN 2 PAD1 30 20 TOP 0 NO INSERT SMD $ENDSHAPES $COMPONENTS COMPONENT U1 PLACE 1500 2000 LAYER TOP ROTATION 90 SHAPE QFP48 DEVICE IC1 $ENDCOMPONENTS $SIGNALS SIGNAL VCC NODE U1 1 NODE R1 1 SIGNAL GND NODE U1 2 $ENDSIGNALS ``` -------------------------------- ### BOARD record example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/MENTOR_NEUTRAL_FORMAT.md Example of a BOARD record with a real design name and zero offsets. BoardRipper assumes OFFSET 0,0 and ORIENTATION 0; deviations are recorded but not applied. ```text BOARD Jinmao14-L_Case2_MainBD_Optimize OFFSET x:0.0 y:0.0 ORIENTATION 0 ``` -------------------------------- ### LaptopSchematic.com list.txt — Hierarchical Tree Source: https://github.com/alexeyinwerp/boardripper/blob/main/Board Database/docs/board-database-spec.md Example from LaptopSchematic.com's list.txt showing hierarchical tree with % markers for indentation and filenames. ```text %%Acer %%notebook %%Acer Aspire 2930 JAT10 LA-4271P MONTEVINA.pdf %%Acer Aspire 3100 5100 5110 / Extensa 5010 5410 / TravelMate 5210 Compal LA-3151.pdf ``` -------------------------------- ### LogiWiki Format A — Example Row Source: https://github.com/alexeyinwerp/boardripper/blob/main/Board Database/docs/board-database-spec.md Example row from LogiWiki's Format A wiki table, showing columns: Screen Size, EMC, Model N, Date, Model ID, Board Number, Board Number 2. ```text Example row: 13" | EMC 2326 | A1278 | Mid 2009 | MacBookPro5,5 | 820-2530 | ``` -------------------------------- ### BVR1 example file Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BVR_FORMAT.md Complete BVR1 example with a rectangular board outline, two pins on U1900 (top) and two on R5201 (bottom), and two test points. Parts are implicitly defined by their first occurrence; all parts default to SMD type. ```text BVRAW_FORMAT_1 <> LOC_X LOC_Y 0.000 0.000 6800.000 0.000 6800.000 4200.000 0.000 4200.000 <> PART_NAME LOC PIN_ID PIN_NAME LOC_X LOC_Y LAYER NET_NAME U1900 (T) 1 A1 1234.567 2345.678 1 PP3V3_S5 U1900 (T) 2 A2 1234.567 2395.678 1 PP5V_S3 R5201 (B) 1 1 500.000 1000.000 2 GND R5201 (B) 2 2 550.000 1000.000 2 PP1V8_S3 <> PROBE LOC_X LOC_Y TYPE GRID LOC NET_ID NET_NAME 1 1234.567 2345.678 1 A1 (T) 100 PP3V3_S5 2 500.000 1000.000 2 B3 (B) 200 GND ``` -------------------------------- ### KiCad PCB top-level structure example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/KICAD_PCB_FORMAT.md Shows the overall layout of a .kicad_pcb file, including the file header, general parameters, layers, nets, footprints, and various graphical and routing elements. The parser addresses optional fields by keyword lookup rather than index because token order inside lists is not guaranteed. ```lisp (kicad_pcb (version 20221018) (generator pcbnew) (general (thickness 1.6)) (paper "A4") (layers (0 "F.Cu" signal) (1 "In1.Cu" signal) (31 "B.Cu" signal) (44 "Edge.Cuts" user) …) (setup …) (net 0 "") (net 1 "GND") (net 2 "+3V3") … (footprint "lib:name" (layer "F.Cu") (at 83.7 141.998 90) (attr smd) (fp_text reference "C1508" (at 2.5 0) (layer "F.SilkS") hide …) (fp_text value "470p" (at -1.2125 0 180) (layer "F.Fab") …) (fp_line (start -0.1 0) (end -0.2 0) (layer "F.SilkS") (width 0.12) …) (pad "1" smd roundrect (at -0.8625 0 90) (size 1.075 0.95) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) (net 63 "Net-(C1508-Pad1)") (pintype "passive") …)) … (gr_line (start 47.7 55.6105) (end 137.7 55.6105) (layer "Edge.Cuts") (width 0.5) …) (gr_arc (start 137.7 55.6105) (mid 141.235534 57.074966) (end 142.7 60.6105) (layer "Edge.Cuts") (width 0.5) …) (segment (start 17.45 19.2) (end 18.225 18.425) (width 0.1524) (layer "F.Cu") (net 1) …) (arc (start …) (mid …) (end …) (width 0.2) (layer "F.Cu") (net 3) …) (via micro (at 23.65 18.575) (size 0.2) (drill 0.1) (layers "F.Cu" "In1.Cu") (net 1) …) (zone …)) ``` -------------------------------- ### Geometry section example (GEOM/G_PIN/G_ATTR) Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/MENTOR_NEUTRAL_FORMAT.md Example of a footprint definition in shape-local coordinates. G_PIN defines pins with number, coordinates, padstack, and surface type. G_ATTR adds attributes like COMPONENT_PLACEMENT_OUTLINE and COMPONENT_HEIGHT. Pin coordinates are pre-rotated; component placements rotate via COMP's rotation. ```text GEOM b1608 G_PIN 1 -0.0256 0.0 s029x035 Surf G_PIN 2 0.0256 0.0 s029x035 Surf G_ATTR 'COMPONENT_PLACEMENT_OUTLINE' '' -0.0501 0.0275 -0.0501 -0.0275 0.0501 -0.0275 0.0501 0.0275 G_ATTR 'COMPONENT_HEIGHT' '' 0.0374 0.0 ``` -------------------------------- ### Example decoding of raw byte 0xEB Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BRD_FORMAT.md Step-by-step calculation showing how raw byte 0xEB decodes to 'P' (0x50). ```text c = -21 c >> 6 = -1 → (-1) & 3 = 3 c << 2 = -84 = 0xFFFFFFAC 3 | 0xFFFFFFAC = 0xFFFFFFAF ~0xFFFFFFAF & 0xFF = 0x50 = 'P' ``` -------------------------------- ### Build from source Source: https://github.com/alexeyinwerp/boardripper/blob/main/README.md Clones the repository, builds the frontend bundle, and runs the Go server. The server serves the built frontend and indexes the library. Access at http://localhost:8080. ```bash git clone https://github.com/AlexeyInwerp/BoardRipper.git cd BoardRipper # Build the frontend bundle: cd src/frontend && npm install && npm run build && cd ../.. # Run the Go server pointing at the built bundle (go.mod lives in src/backend): cd src/backend STATIC_DIR=../frontend/dist DATA_DIR=../../data LIBRARY_DIR=/path/to/boards go run . # → http://localhost:8080 ``` -------------------------------- ### package.json postinstall script for patch-package Source: https://github.com/alexeyinwerp/boardripper/blob/main/src/frontend/patches/README.md Defines the postinstall script that runs patch-package after every npm install or npm ci, applying the diffs in this folder. This is the standard patch-package setup. ```json { "scripts": { "postinstall": "patch-package" } } ``` -------------------------------- ### IPC handlers for MCP enabled state Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-15-desktop-mcp-backend-sidecar-plan.md Registers IPC handlers to get and set the MCP-enabled setting. The set handler starts or stops the backend sidecar and returns whether MCP is enabled after the operation. ```javascript ipcMain.handle('get-mcp-enabled', () => !!loadSettings().mcpEnabled); ipcMain.handle('set-mcp-enabled', async (_event, on) => { const settings = loadSettings(); settings.mcpEnabled = !!on; saveSettings(settings); if (on) { return await startBackendAndLoad(); // true on success, false if unhealthy } stopCurrentBackend(); await loadStaticFile(); return false; }); ``` -------------------------------- ### Volume mounting for Library panel Source: https://github.com/alexeyinwerp/boardripper/blob/main/README.md Example Docker volume mounts for the Library panel. Mount your board folders as subdirectories of /library, using :ro for read-only access. The only writable mount should be /library/incoming, where drag-dropped files land. ```text -v /nas/boards/MacBooks:/library/MacBooks:ro -v /nas/boards/iPhones:/library/iPhones:ro -v /nas/schematics:/library/Schematics:ro -v /nas/incoming:/library/incoming:rw ``` -------------------------------- ### Real-World Messy Filenames Source: https://github.com/alexeyinwerp/boardripper/blob/main/Board Database/docs/board-database-spec.md Example filenames that the matching engine must handle, showing typical patterns like board numbers, brand names, and model identifiers mixed with extra text. ```text NM-A251 Rev 1.0 schematic.pdf 820-02016-A_MLB_Schematic.pdf ThinkPad_T450_AIVL0_NM-A251_BoardView.brd DELL_Inspiron_7370_Wistron_16839-1_Schematic.pdf LA-E541P REV 0.3 compal.pdf A1708_820-00840_logic_board.pdf HP_ProBook_450_G6_DAX8JMB16E0_schematic.pdf random junk NM-B291 more junk.bin LENOVO-T580-NM-B463-01LW234.zip ``` -------------------------------- ### B_ADDP record examples Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/MENTOR_NEUTRAL_FORMAT.md Shows three B_ADDP records for guidehole, fiducial_top, and silkscreen label parts. These carry no electrical role and are skipped by the parser. ```text B_ADDP guidehole 'guidehole' 2.705 7.413 0 1 1 1 B_ADDP fiducial_top 'fiducial_top' 8.32 7.82 0 1 1 1 B_ADDP sl_lf_main_t 'sl_lf_main_t' 3.18 1.155 0 1 1 1 ``` -------------------------------- ### Preview locally with open command Source: https://github.com/alexeyinwerp/boardripper/blob/main/landing/README.md Opens the landing page in the default browser. Works as-is via file://, no server needed. ```bash open landing/index.html ``` -------------------------------- ### Multi-line search query example Source: https://github.com/alexeyinwerp/boardripper/blob/main/landing/index.html Shows a multi-line search input where each line acts as an AND-filter. Used to find components matching all criteria, e.g., a capacitor with value 20uF, voltage 10V, and designator starting with C12. ```text 20uF 10V C12* ``` -------------------------------- ### Run tests and build Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-09-mcp-phase1-access.md Command to run Go tests for the live binary tools, build the backend, and type-check the frontend. Expects PASS and no build errors. ```bash cd src/backend && go test ./mcpserver/ -run 'TestLiveBinary|TestBinaryResult' -v && go build ./... && cd ../frontend && npx tsc --noEmit ``` -------------------------------- ### Create release.env with credentials Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/RELEASE_RUNBOOK.md Writes the release environment file with FTP, GHCR, and minisign credentials, then sets permissions to 0600. The MINISIGN_PASSWORD makes release.sh non-interactive. ```bash cat > ~/.config/boardripper/release.env < GHCR_USER=alexeyinwerp GHCR_TOKEN= MINISIGN_PASSWORD= EOF chmod 600 ~/.config/boardripper/release.env ``` -------------------------------- ### Verify macOS cross-compiled binary builds and serves health Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-15-desktop-mcp-backend-sidecar-plan.md Builds the backend for macOS, starts it on port 18099, checks /api/health, and cleans up. Expected output: BUILD OK and {"status":"ok"}. ```bash cd /Users/besitzer/Desktop/Boardviewer/src/backend && \ CGO_ENABLED=0 GOOS=darwin GOARCH=$([ "$(uname -m)" = "arm64" ] && echo arm64 || echo amd64) \ go build -ldflags="-s -w" -o /tmp/br-server-test . && echo "BUILD OK" DATA=$(mktemp -d); PORT=18099 DATA_DIR="$DATA" STATIC_DIR=/tmp /tmp/br-server-test & SRV=$!; sleep 2; echo "--- health ---"; curl -sf http://127.0.0.1:18099/api/health; echo kill $SRV; rm -rf "$DATA" /tmp/br-server-test ``` -------------------------------- ### Local preview and test commands for Lite build Source: https://github.com/alexeyinwerp/boardripper/blob/main/src/frontend/LITE_BUILD.md Commands to serve, preview, run a dev server, and run E2E tests for the Lite build. The serve command uses a sub-path (dist-lite/ at http://localhost:18086/boardripper/web/), while preview uses the root path. The test command is an E2E gate ensuring zero /api calls, sub-path dist project, and UI absence. ```bash npm run serve:lite # dist-lite/ at http://localhost:18086/boardripper/web/ npm run preview:lite # dist-lite/ at the root path npx vite --mode lite # dev server in lite mode npm run test:lite # E2E gate: zero /api, sub-path dist project, UI absence ``` -------------------------------- ### Build and test commands Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-06-15-mcp-server-live-board-bridge-plan.md Verifies the implementation compiles and passes tests. Run 'cd src/backend && go build ./... && go test ./mcpserver/ -run TestState' expecting PASS. ```bash cd src/backend && go build ./... && go test ./mcpserver/ -run TestState ``` -------------------------------- ### Build and verify relative base for lite and NAS builds Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-20-boardripper-web-standalone-plan.md Commands to build and verify the lite build and the NAS build. The first builds with build:lite and greps dist-lite/index.html expecting every emitted script/style/icon path to begin with './' (no leading '/'). The second builds the NAS build and greps dist/index.html expecting root-absolute assets (/assets/...) apart from the favicon now being './logo.svg'. ```bash cd src/frontend && npm run build:lite grep -oE '(src|href)="[^"]*"' dist-lite/index.html ``` ```bash npm run build && grep -oE '(src|href)="[^"]*"' dist/index.html | head -5 ``` -------------------------------- ### NAILS Section Example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BDV_FORMAT.md Example of test points / via probes with two nails. Each nail has an identifier, position, net index, and side. ```text NAILS: 2 1 400 300 2 1 2 600 500 3 2 ``` -------------------------------- ### Install vite-plugin-pwa devDependency Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-20-boardripper-web-standalone-plan.md Installs the vite-plugin-pwa package as a dev dependency in the frontend project. Expected result: the package appears in devDependencies and package-lock.json updates. ```bash cd src/frontend && npm install -D vite-plugin-pwa ``` -------------------------------- ### NETS Section Example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/BDV_FORMAT.md Example of a net name lookup table with three nets (VCC, GND, SDA). Indices are 1-based and referenced by PINS and NAILS. ```text NETS: 3 1 VCC 2 GND 3 SDA ``` -------------------------------- ### Run the full suite and compare against baseline Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-08-04-hdr-focus-glow.md Runs TypeScript type checking, unit tests, and Playwright tests. A large cohort of board/PDF-render specs fails headless due to missing WebGL, which is pre-existing and unrelated. Get the baseline failed count from main and confirm this branch's count is the same or lower. ```bash cd src/frontend && npx tsc --noEmit && npx vitest run && npx playwright test ``` -------------------------------- ### Block Structure Definition Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/FZ_FORMAT.md Defines the general structure of an FZ file, where lines starting with 'A' are block headers with column names and lines starting with 'S' are data records. ```plaintext A!!!!... ← Block header S!!!... ← Data records S!!!... ``` -------------------------------- ### Deploy Lite build to ripperdoc.de Source: https://github.com/alexeyinwerp/boardripper/blob/main/src/frontend/LITE_BUILD.md Deploys the Lite build by building and uploading only the /boardripper/web/ subtree. Run from the src/frontend directory. The deploy script uses lftp with mirror --reverse --delete and requires FTP credentials from a sibling file or environment variables. ```bash cd src/frontend npm run deploy:lite # build + upload only the /boardripper/web/ subtree ``` -------------------------------- ### Register board_overview tool in tools_live.go Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-09-mcp-phase1-access.md Registers the board_overview live tool in Go, providing a one-call orientation with board and worklist summary. Recommended as the first call. ```go liveTool[emptyArgs](s, b, "board_overview", "One-call orientation: the active board's name, part/net counts, shown side, open PDFs (name/page/pageCount/fileId), and a worklist summary (entry counts, pending measurements, unread user messages). Recommended first call.", "board_overview", true, nil) ``` -------------------------------- ### EAGLE BRD curve attribute example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/EAGLE_BRD_FORMAT.md An example wire with a curve attribute, which is the signed included angle in degrees, CCW-positive, in the open range (-360, 360). It is used verbatim by eagleArcPoints(). ```xml ``` -------------------------------- ### NET_NAME Block Example (Pins) Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/FZ_FORMAT.md Example of the NET_NAME block that contains pin data. The block header defines fields: NET_NAME, REFDES, PIN_NUMBER, PIN_NAME, X, Y, TEST_POINT, and RADIUS. ```plaintext A!NET_NAME!REFDES!PIN_NUMBER!PIN_NAME!X!Y!TEST_POINT!RADIUS! S!VCC!U1!1!VDD!1500!2000!0!50! ``` -------------------------------- ### Run tests and build Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-09-mcp-phase2-harness.md Commands to run the specific test and full package test/build. Step 5 runs the TestPrompts_ListAndGet test, Step 6 runs the full package test and build. ```bash cd src/backend && go test ./mcpserver/ -run TestPrompts_ListAndGet -v ``` ```bash cd src/backend && go test ./mcpserver/ && go build ./... ``` -------------------------------- ### go run command with environment variables Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/specs/2026-09-12-fresh-install-review.md Command to run the backend from the source, setting STATIC_DIR and DATA_DIR environment variables. This command fails because there is no go.mod at the repo root; you must cd src/backend first. ```bash STATIC_DIR=./src/frontend/dist DATA_DIR=./data go run ./src/backend ``` -------------------------------- ### Gate MCP bridge start with isLiteBuild Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-20-boardripper-web-standalone-plan.md In mcp-bridge.ts, add the isLiteBuild import and replace startMcpBridgeIfEnabled() (lines 147-155) with a version that returns early in lite builds, preventing the /api/mcp/status fetch and bridge start. ```ts import { isLiteBuild } from './build-mode'; ``` ```ts /** Check whether MCP is enabled on the backend and, if so, start the bridge. */ export function startMcpBridgeIfEnabled() { if (isLiteBuild()) return; // lite web build: no backend, no bridge fetch('/api/mcp/status') .then((r) => (r.ok ? r.json() : null)) .then((s) => { if (s && s.enabled) startMcpBridge(); }) .catch(() => {}); } ``` -------------------------------- ### TypeScript: Start MCP bridge from app bootstrap Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-06-15-mcp-server-live-board-bridge-plan.md Add to app bootstrap where other stores/effects start. Fetches /api/mcp/status and calls startMcpBridge if enabled. Note: endpoint added in Task 17; until then fetch 404s and bridge stays off. ```typescript import { startMcpBridge } from './store/mcp-bridge'; // Start the MCP bridge if the server is enabled (status from /api/mcp/status). fetch('/api/mcp/status') .then((r) => (r.ok ? r.json() : null)) .then((s) => { if (s && s.enabled) startMcpBridge(); }) .catch(() => {}); ``` -------------------------------- ### Run tests and build Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-01-library-bench-folders-restructure.md Run the tests to verify the changes. Expected: PASS for both TestScanFolderAsyncScopesInsertsAndDeletes and TestScanFolderAsyncRejectsEscape, then `go build ./...` with no errors. ```bash cd src/backend && go test ./databank/ -run TestScanFolder -v ``` ```bash go build ./... ``` -------------------------------- ### main.js: loadStaticFile, resolvePort, startBackendAndLoad, handleUnexpectedExit, stopCurrentBackend, boot Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-15-desktop-mcp-backend-sidecar-plan.md Core functions for the mcpEnabled lifecycle. loadStaticFile loads the static index.html. resolvePort prefers a persisted port or picks a free one. startBackendAndLoad spawns the backend, waits for health, seeds mcp_enabled, and loads the URL; on failure it disables MCP and falls back to static. handleUnexpectedExit retries with backoff (1s, 3s, 9s) and disables MCP after 3 crashes. stopCurrentBackend stops the current backend. boot honors the persisted mcpEnabled setting. ```javascript function loadStaticFile() { const indexPath = path.join(WEBAPP_DIR, 'index.html'); log('INFO', `Loading: ${indexPath}`); return mainWindow.loadFile(indexPath).then(() => { log('INFO', 'index.html loaded successfully'); }).catch((err) => { logFatal('Failed to load index.html', err); }); } /** Resolve the loopback port for the sidecar. Prefer the persisted port so an * external MCP client's saved connect URL survives restarts; fall back to a * fresh free port (and persist it) if the preferred one is taken. */ async function resolvePort() { const settings = loadSettings(); if (settings.mcpPort && await isPortFree(settings.mcpPort)) { return settings.mcpPort; } const port = await pickFreePort(); const s = loadSettings(); s.mcpPort = port; saveSettings(s); return port; } /** Spawn the backend, wait for health, seed mcp_enabled, then load the window * from it. On startup failure: kill, revert mcpEnabled to false so the next * launch doesn't retry a broken setup, and fall back to loadStaticFile(). * Returns true on success. A later unexpected exit (genuine crash) is handled * by the 'exit' listener → handleUnexpectedExit(), not this function. */ async function startBackendAndLoad() { stoppingDeliberately = false; const settings = loadSettings(); const port = await resolvePort(); log('INFO', `Starting backend sidecar on port ${port}...`); const proc = startBackend({ dataDir: app.getPath('userData'), libraryDir: settings.libraryPath || '', staticDir: WEBAPP_DIR, boardDbPath: resolveBoardDbPath(), port, }); proc.stdout.on('data', d => log('INFO', `[backend] ${d.toString().trim()}`)); proc.stderr.on('data', d => log('ERROR', `[backend] ${d.toString().trim()}`)); let exitedDuringStartup = false; proc.on('exit', (code, signal) => { log('ERROR', `Backend sidecar exited: code=${code} signal=${signal}`); const wasCurrent = currentBackend && currentBackend.proc === proc; if (wasCurrent) currentBackend = null; if (!wasCurrent) { exitedDuringStartup = true; return; } // handled below if (stoppingDeliberately) return; // user-initiated, not a crash void handleUnexpectedExit(); }); const healthy = await waitForHealth(port); if (!healthy || exitedDuringStartup) { log('ERROR', 'Backend sidecar failed to become healthy — disabling MCP'); stopBackend(proc); const s = loadSettings(); s.mcpEnabled = false; saveSettings(s); dialog.showErrorBox( 'BoardRipper — MCP server failed to start', `The local server did not become healthy in time. MCP has been disabled.\n\nLog: ${LOG_FILE}`, ); return false; } await enableMcpConfig(port); currentBackend = { proc, port }; crashRetries = 0; log('INFO', `Backend sidecar healthy, loading http://127.0.0.1:${port}/`); await mainWindow.loadURL(`http://127.0.0.1:${port}/`); return true; } /** A previously-healthy backend died mid-session. Retry with backoff (1s, 3s, * 9s); if exhausted, disable MCP and fall back to the static file so the app * stays usable. */ async function handleUnexpectedExit() { if (crashRetries >= 3) { logFatal('Backend sidecar crashed repeatedly', new Error('Exceeded restart retries')); const s = loadSettings(); s.mcpEnabled = false; saveSettings(s); await loadStaticFile(); return; } crashRetries += 1; const delayMs = 1000 * 3 ** (crashRetries - 1); // 1s, 3s, 9s log('INFO', `Backend sidecar crashed — retrying in ${delayMs}ms (attempt ${crashRetries}/3)`); await new Promise(r => setTimeout(r, delayMs)); await startBackendAndLoad(); } function stopCurrentBackend() { if (currentBackend) { stoppingDeliberately = true; stopBackend(currentBackend.proc); currentBackend = null; } } /** Startup entry point: honours the persisted mcpEnabled setting. */ async function boot() { const settings = loadSettings(); if (settings.mcpEnabled) { const ok = await startBackendAndLoad(); if (ok) return; } await loadStaticFile(); } ``` -------------------------------- ### HOLE section example Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/MENTOR_NEUTRAL_FORMAT.md Shows the HOLE record format with NPTH and PTH examples. NPTH holes are non-plated, PTH holes are plated and may include an optional plating offset. BoardRipper drops these on initial parse. ```text HOLE NPTH 7.95322 2.4849 0.043 HOLE PTH 8.26 5.165 0.028 0.0 ``` -------------------------------- ### Build the hosted lite build (npm run build:lite) Source: https://github.com/alexeyinwerp/boardripper/blob/main/src/frontend/LITE_BUILD.md Run from src/frontend to produce the self-contained, host-portable dist-lite/ folder with relative base and PWA support. Deploy the folder as-is at any mount point. ```bash cd src/frontend npm run build:lite # → dist-lite/ (relative base, PWA, no backend UI) ``` -------------------------------- ### Cross-compile Go backend for macOS universal binary (build-mac.mjs) Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-07-15-desktop-mcp-backend-sidecar-plan.md Builds the Go backend for macOS, creating a universal binary with lipo when requested. Uses CGO_ENABLED=0 and sets GOOS/GOARCH. Copies the boards.db file after building. ```javascript // ---------- 2.5. Cross-compile the Go backend sidecar ---------- const BACKEND = path.join(ROOT, 'src', 'backend'); const BIN_DIR = path.join(DESKTOP, 'bin'); const APP_VERSION = JSON.parse(readFileSync(path.join(FRONTEND, 'package.json'), 'utf8')).version; if (existsSync(BIN_DIR)) rmSync(BIN_DIR, { recursive: true }); mkdirSync(BIN_DIR, { recursive: true }); function goBuild(goarch, outFile) { mkdirSync(path.dirname(outFile), { recursive: true }); console.log(`\n=== Cross-compiling backend darwin/${goarch} ===`); execSync( `go build -ldflags="-s -w -X boardripper/updater.Version=${APP_VERSION}" -o "${outFile}" .`, { cwd: BACKEND, stdio: 'inherit', env: { ...process.env, CGO_ENABLED: '0', GOOS: 'darwin', GOARCH: goarch }, }, ); } const fat = path.join(BIN_DIR, 'darwin', 'server'); mkdirSync(path.dirname(fat), { recursive: true }); if (requestedArch === 'universal') { const armTmp = path.join(BIN_DIR, '.darwin-arm64'); const x64Tmp = path.join(BIN_DIR, '.darwin-x64'); goBuild('arm64', armTmp); goBuild('x64', x64Tmp); execSync(`lipo -create "${armTmp}" "${x64Tmp}" -output "${fat}"`, { stdio: 'inherit' }); rmSync(armTmp); rmSync(x64Tmp); } else { goBuild(requestedArch, fat); } cpSync(path.join(ROOT, 'Board Database', 'boards.db'), path.join(BIN_DIR, 'boards.db')); ``` -------------------------------- ### REFDES Block Example (Components) Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/formats/FZ_FORMAT.md Example of the REFDES block that contains component information. The block header defines fields: REFDES, CIC, SNAME, MIRROR, and ROTATE. The MIRROR field is 'YES' for top side and 'NO' for bottom side. ```plaintext A!REFDES!CIC!SNAME!MIRROR!ROTATE! S!U1!IC1!QFP48!YES!90! S!R1!RES1!0402!NO!0! ``` -------------------------------- ### Run Backend Tests and Build Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-06-25-pdf-donor-manager-auto-index.md Execute tests for donor handlers and build the backend project. ```bash cd src/backend && go test ./handlers/ -run 'TestResetWrites|TestImportSkips' -v && go build ./... ``` -------------------------------- ### GET /api/databank/donors Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/PDF_VIEWER.md Lists all donor file IDs. ```APIDOC ## GET /api/databank/donors ### Description Lists all donor file IDs from the `pdf_donors` table. ### Method GET ### Endpoint /api/databank/donors ### Response #### Success Response (200) - **donors** (array) - List of donor file IDs #### Response Example { "donors": ["file1.pdf", "file2.pdf"] } ``` -------------------------------- ### MCP server mount in main.go Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-06-15-mcp-server-live-board-bridge-plan.md Code to add after databank handler and before middleware wrap, setting up MCP server and mounting handlers. ```go // --- MCP server (off by default; enabled via Settings > Integrations) --- mcpSecret, err := mcpserver.EnsureSecret(dataDir) if err != nil { log.Fatalf("mcp secret: %v", err) } mcpState := mcpserver.NewState(db) mcpBridge := mcpserver.NewBridge() // real impl lands in Phase C; stub returns &Bridge{} mcpSrv := mcpserver.New(&mcpserver.Deps{ State: mcpState, Bridge: mcpBridge, PDF: pdfIndexDB, // wired in Phase B; nil-safe until then Files: db, Boards: boardDB, OBD: obdStore, }) mux.Handle("/api/mcp", mcpserver.Gate(mcpState, mcpSecret, mcpSrv.Handler())) mux.Handle("/api/mcp/", mcpserver.Gate(mcpState, mcpSecret, mcpSrv.Handler())) ``` -------------------------------- ### Add MCP and WebSocket dependencies Source: https://github.com/alexeyinwerp/boardripper/blob/main/docs/plans/2026-06-15-mcp-server-live-board-bridge-plan.md Run these commands from the src/backend directory to add the MCP Go SDK and coder/websocket modules, then tidy the module. This is the first step of Task 1. ```bash cd src/backend go get github.com/modelcontextprotocol/go-sdk/mcp@latest go get github.com/coder/websocket@latest go mod tidy ```