Start the c2n MCP server in web sessions and keep gallery screenshot names stable
Merged
CO
1mo ago+49+49+01234567890123456789-6-6-0123456789
Summary
SessionStart hook for Claude Code on the web
In a fresh cloud clone, the c2n MCP server in .mcp.json (node packages/tools/mcp/src/cli.ts) exited at startup (CONNECTION_CLOSED). It needs node_modules and the gitignored data/registry.json, and a fresh clone has neither.
.claude/hooks/session-start.sh, registered in.claude/settings.json, runs only in remote sessions. It runsnpm install, thennpm run build:registry -w packages/tools/mcp. It writes everything to stderr, so none of the output ends up in the session's context.- The hook exports
CHROMIUM_PATHfor the container's preinstalled Chromium.playwright.config.tsnow launches that path when it is set, the same wayapps/ui/scripts/gallery-shots.mjsalready does. Without it, the component tests fail because the Chromium version Playwright expects is not installed in the container. - One paragraph in
CLAUDE.mddescribes the hook.
Stable gallery screenshot names
The registry's screenshot URLs point at the latest Pages deploy, which we keep. The file name is the card's slug, so the slug must not depend on card order.
- In
navigation-menu.mdx, the cardlabel=Mobile, collapsible groupswas read as "Mobile", because a comma ends a fence meta value. It collided with the other "Mobile" card and got the order-dependent slugpanel--mobile-2. It is renamed "Collapsible mobile", so its slug is nowpanel--collapsible-mobile. exampleSluginpackages/tools/mcp/scripts/gallery.tsnow fails the registry build when two cards in one section share a label, instead of numbering them-2,-3. No other gallery triggers it.
Validation
- Hook: exits 0; a clean run takes about 3 min, reruns are cached by wireit. The MCP server then answers
initialize. npm run build:tools,npm run mcp:smoke: pass; generated skill/plugin files unchanged.- The registry built twice lists the same 735 screenshot URLs.
- Checkbox suite with
CHROMIUM_PATH: 7/7 pass. - eslint and prettier: pass on the changed files.
Note: panel--mobile-2.{light,dark}.png disappears from Pages on the next deploy. Only that one card's image breaks, and only for MCP versions released before this change.
š¤ Generated with Claude Code
https://claude.ai/code/session_011Vk53fCCtwpXR13PQS2Mrt
Generated by Claude Code