feat(web): wire gerbview tool (file-less launch, wizard-skip, UI)

Register the newly WASM-ported Gerber Viewer in the web app the same way as
the other tools — registry entries only, no UI edits (ProjectDetailPage renders
launch links generically from FILELESS_TOOLS).

GERBVIEW_FRAME opens gerber/drill files through its own File→Open UI and projects
carry no gerber files to auto-open, so it's treated as file-less (boot standalone),
mirroring symbol_editor. It boots through single_top.cpp's STARTWIZARD, so it seeds
config to skip the first-run wizard (TOOL_NEEDS_CONFIG_SEED) and gets a
/usr/bin/gerbview argv0.

- contract: add "gerbview" to TOOLS, TOOL_LABELS ("Gerber Viewer"), FILELESS_TOOLS
- frontend: add gerbview to TOOL_ARGV0 and TOOL_NEEDS_CONFIG_SEED
- e2e: add file-less gerbview case to tools-open.spec.ts (title "Gerber Viewer",
  canvas painted, wizard-free, no WASM abort)

Verified in-browser via npm run test:web: gerbview boots wizard-free with the
viewer chrome (toolbars + layers manager), 0 console errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Balint Ipkovich 2026-06-03 16:47:23 +02:00
commit 03fbd73e99
3 changed files with 8 additions and 0 deletions

View file

@ -26,6 +26,7 @@ const CASES: Record<string, ToolCase> = {
pl_editor: { route: 'pl_editor/demo.kicad_wks', titleRe: /demo — Drawing Sheet Editor/i, fileless: false },
calculator: { route: 'calculator/', titleRe: /Calculator Tools/i, fileless: true },
symbol_editor: { route: 'symbol_editor/', titleRe: /Symbol Editor/i, fileless: true },
gerbview: { route: 'gerbview/', titleRe: /Gerber Viewer/i, fileless: true },
};
/** Console text that must never appear (wizard-crash + URL-regex modal markers). */

View file

@ -26,6 +26,7 @@ export const TOOL_ARGV0: Record<Tool, string> = {
calculator: "/usr/bin/pcb_calculator",
pl_editor: "/usr/bin/pl_editor",
symbol_editor: "/usr/bin/symbol_editor",
gerbview: "/usr/bin/gerbview",
};
/**
@ -43,6 +44,7 @@ export const TOOL_NEEDS_CONFIG_SEED: Record<Tool, boolean> = {
calculator: true,
pl_editor: true,
symbol_editor: true,
gerbview: true,
};
/** KiCad user settings dir for this build (PATHS::GetUserSettingsPath()). */

View file

@ -7,6 +7,7 @@ export const TOOLS = [
"calculator",
"pl_editor",
"symbol_editor",
"gerbview",
] as const;
export const toolSchema = z.enum(TOOLS);
export type Tool = z.infer<typeof toolSchema>;
@ -18,6 +19,7 @@ export const TOOL_LABELS: Record<Tool, string> = {
calculator: "PCB Calculator",
pl_editor: "Drawing Sheet Editor",
symbol_editor: "Symbol Editor",
gerbview: "Gerber Viewer",
};
/** Default file-extension → tool mapping (the explicit URL segment always wins). */
@ -31,10 +33,13 @@ export const EXTENSION_TOOL: Record<string, Tool> = {
* Tools that do not take a file (booted standalone). The calculator has no file
* concept; the symbol editor opens libraries through its own UI (its frame does
* not implement OpenProjectFiles), so we boot it standalone rather than auto-open.
* The gerber viewer likewise opens gerber/drill files through its own FileOpen
* UI projects carry no gerber files to auto-open so it boots standalone too.
*/
export const FILELESS_TOOLS: ReadonlySet<Tool> = new Set<Tool>([
"calculator",
"symbol_editor",
"gerbview",
]);
export const projectSlugSchema = z