Skip to content

feat: add --port / FIGMA_PORT option for custom CDP port#21

Open
dandaka wants to merge 5 commits into
silships:mainfrom
dandaka:feat/custom-cdp-port
Open

feat: add --port / FIGMA_PORT option for custom CDP port#21
dandaka wants to merge 5 commits into
silships:mainfrom
dandaka:feat/custom-cdp-port

Conversation

@dandaka

@dandaka dandaka commented Jun 14, 2026

Copy link
Copy Markdown

Summary

  • Add --port flag and FIGMA_PORT env var to specify a custom Chrome DevTools Protocol port
  • Default remains 9222 for backwards compatibility
  • Fixes port conflicts when Chrome already uses 9222

Motivation

Users running Chrome with --remote-debugging-port=9222 cannot use figma-cli without a conflict. This is common for developers using browser automation tools.

Changes

  • getCdpPort() in figma-patch.js now reads FIGMA_PORT env var (validated, falls back to 9222)
  • Added --port <number> global CLI option (sets FIGMA_PORT before command execution)
  • Parameterized the hardcoded 9222 in render.js diagnostics
  • getFigmaCommand() default now uses getCdpPort() instead of hardcoded 9222

Test plan

  • New test: tests/cdp-port.test.js — verifies env var reading, default, and invalid input handling
  • All existing tests pass unchanged
  • Manual: figma-cli --port 9333 connect starts Figma on port 9333
  • Manual: FIGMA_PORT=9333 figma-cli connect starts Figma on port 9333
  • Manual: figma-cli connect still defaults to port 9222

🤖 Generated with Claude Code

dandaka and others added 5 commits June 14, 2026 15:38
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d 9222

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@LuuOW LuuOW left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technical audit: Implementation verified for architectural consistency and engineering integrity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants