Skip to content

feat: configurable URL opener via open.command_template#70

Merged
gavin-jeong merged 1 commit into
masterfrom
feat/configurable-url-opener
Jul 16, 2026
Merged

feat: configurable URL opener via open.command_template#70
gavin-jeong merged 1 commit into
masterfrom
feat/configurable-url-opener

Conversation

@gavin-jeong

Copy link
Copy Markdown
Collaborator

What

URL을 여는 경로를 하드코딩된 open/xdg-open 대신 config로 설정 가능한 command template로 바꿨습니다. 기존 claude.command_template({{args}} 치환) 패턴을 그대로 미러링했습니다.

Usage

config.yaml (~/.config/ccx/config.yaml):

open:
  command_template: "tmux-chrome open {{url}}"

CLI (기존 범용 setter가 그대로 지원):

ccx config set open.command_template "tmux-chrome open {{url}}"

Behavior

  • {{url}} 이 URL로 치환됩니다.
  • {{url}} 을 생략하면 URL이 마지막 인자로 append 됩니다 (예: "firefox --new-tab").
  • template이 비어 있으면 기존 OS 기본 동작(macOS open, Linux xdg-open)으로 폴백합니다.
  • argv로 파싱되어 직접 실행(shell 미평가)되므로 공백 경로는 따옴표로: '/opt/my browser/open' {{url}}.

적용 범위: URL 액션 메뉴 + conversation URL 브라우저. 파일 경로를 여는 openInEditor 는 별도 로직이라 대상 아님.

Changes

  • 신규 internal/opener/opener.go + opener_test.go
  • internal/claudecmd/claudecmd.gosplitTemplateSplitTemplate export (opener 재사용)
  • internal/tui/{state,app,urls,conversation}.goopen.Config 배선, 두 호출부를 opener.Open 으로 교체
  • internal/cli/run_pick.go, main.goLoadCCXConfig 반환값 배선
  • internal/extract/extract.go — 미사용이 된 OpenInBrowser 및 관련 import 제거
  • README.md — "URL opener" 섹션 추가

Test

  • go build ./..., go vet ./..., go test ./... 전부 통과
  • CLI 왕복(config setconfig view) 실제 확인

URLs opened from the conversation URL browser and the URL action menu now go
through a config-driven command template instead of a hardcoded open/xdg-open.

- New internal/opener package mirrors the claudecmd template pattern:
  {{url}} placeholder, appends URL when omitted, empty template falls back to
  the OS default handler (open on macOS, xdg-open on Linux).
- Export claudecmd.SplitTemplate for reuse by the opener tokenizer.
- Wire open.Config through CCXConfig / LoadCCXConfig / App.Config; the existing
  'ccx config set open.command_template ...' CLI works via the generic setter.
- Drop the now-unused extract.OpenInBrowser.

Example: open.command_template: "tmux-chrome open {{url}}"
@Kairo-Kim Kairo-Kim added the auto-review/approved Auto-approved by the Slack auto-reviewer bot label Jul 16, 2026

@jinsekim jinsekim 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.

LGTM!

@jinsekim jinsekim 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.

LGTM!

@gavin-jeong
gavin-jeong merged commit e347109 into master Jul 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-review/approved Auto-approved by the Slack auto-reviewer bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants