fix: IME切り替えを物理かな/英数キー発行方式に変更(+ claude-lmstudio / prettier整理) - #996
Conversation
デフォルトモデルを openai/gpt-oss-20b から qwen/qwen3-coder-next へ変更し、 LM Studio 側の実測で判明した2つの障害を回避する。 - コンテキスト長: LM Studio の JIT ロードは 8k を選ぶため Claude Code の システムプロンプトが入らず 500 になる。起動時に 262144 でロードする。 - 重複インスタンス: 小さいコピーを残したまま load すると LM Studio は model key でルーティングして古い方を使い続けるため、先にアンロードする。 MLX ランタイムの vendored CPython 欠落時の復旧手順もコメントに残す。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
.playwright-mcp/ は Playwright MCP がセッション毎に生成する未追跡ファイルで、 整形対象に入ると無関係な変更でも pre-commit の format:check が落ちる。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ctrl+Shift+J/; の TISSelectInputSource(モード選択) は、同一 Google IME 内の base<->Roman 切り替えでメニュー表示だけ更新し実際の変換モードを切り替えないため、 ツールチップは日本語なのに入力が英語のままになる事象があった。 skhd のアクションを send-ime-key(かな=104/英数=102 を CGEvent で HID 層に post)へ 差し替え、Kanary の Cmd タップと同じ確実な経路に統一。select-input-source(TIS版)は エージェントの照会・選択用途のため存置。
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR adds physical macOS IME key injection, an LM Studio-backed Claude launcher, allowlist-based devcontainer environment loading, private configuration assertions, and formatting/documentation updates. ChangesmacOS IME switching
Local agent tooling
Repository and private configuration hygiene
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant skhd
participant send-ime-key.sh
participant send-ime-key.swift
participant macOS HID
skhd->>send-ime-key.sh: Invoke kana or eisuu
send-ime-key.sh->>send-ime-key.swift: Run Swift helper
send-ime-key.swift->>macOS HID: Post key-down and key-up events
sequenceDiagram
participant User
participant claude-lmstudio.sh
participant LM Studio
participant lms
participant Claude CLI
User->>claude-lmstudio.sh: Start launcher
claude-lmstudio.sh->>LM Studio: Check /v1/models
claude-lmstudio.sh->>lms: Inspect and manage model copies
lms->>LM Studio: Unload or load model
claude-lmstudio.sh->>Claude CLI: Execute with model and endpoint
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea70f7ad2e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| @@ -1,20 +0,0 @@ | |||
| # Agent Deck Configuration | |||
There was a problem hiding this comment.
Restore the deleted dotfile sources
When applying the nix-darwin/home-manager config, this deletion leaves nix/home/dotfiles.nix:14-16 pointing at configRoot + /dot/config/agent-deck/config.toml and configRoot + /dot/config/codespaces-secrets/repos.txt, but both files are removed in this commit. Nix will try to realize those home.file sources and fail before activation, so darwin-rebuild switch --flake ... is broken unless these entries are moved to the new private-config symlink mechanism or the files are restored.
Useful? React with 👍 / 👎.
| @@ -1,27 +0,0 @@ | |||
| # MCP サーバー環境変数テンプレート | |||
There was a problem hiding this comment.
Keep credential templates available
Removing this template leaves the credential workflow inconsistent: test/integration/credentials_templates.bats:23 still asserts credentials/templates/mcp.env.template exists, and credentials/README.md still instructs users to generate MCP/devcontainer env files from these templates. In environments running the integration tests or script/credentials.sh fetch, the repo no longer has a source template to validate or inject, so either keep sanitized templates or update the test/docs/script as part of the move to private config.
Useful? React with 👍 / 👎.
| }); | ||
| [zshModule, devcontainerEnvLoader].forEach((loader) => { | ||
| // 許可キーはインライン列挙せず private-config 管理の外部ファイルから読む | ||
| expect(loader).toContain('devcontainer-env-keys.txt'); |
There was a problem hiding this comment.
Implement the private env-key allowlist
These new assertions do not match the implementation in this commit: a repo-wide search for devcontainer-env-keys.txt only finds the new tests, while nix/home/zsh.nix and .zsh/configs/pre/devcontainer-env.zsh still hard-code the allowed keys and still contain the ELU_* names that line 215 rejects. As soon as Jest is available, test/nix-darwin-config.test.js fails here, so the allowlist loader/private-config file needs to be implemented or the expectation should not be added yet.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@script/agent/claude-lmstudio.sh`:
- Around line 46-51: Update the required CLI validation loop in the
claude-lmstudio script to include node alongside claude and lms, so the script
exits with the existing clear PATH error before attempting the node-based JSON
parsing.
In `@script/macos/send-ime-key.sh`:
- Line 7: Update the send-ime-key.sh execution flow to avoid invoking xcrun
swift on every run; compile the Swift source with swiftc -O during setup or a
first-run cache step, then execute the resulting binary directly while
preserving the existing "$src" "$@" arguments.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: da9e1081-5da0-4622-b778-46fa39e879c8
📒 Files selected for processing (17)
.prettierignorecredentials/templates/devcontainer.env.templatecredentials/templates/mcp.env.templatedocs/adr/0016-use-kanary-for-keyboard-remapping.mddocs/adr/README.mddot/config/agent-deck/config.tomldot/config/codespaces-secrets/repos.txtnix/home/agent-commands.nixnix/home/default.nixnix/home/input-source.nixnix/hosts/darwin/default.nixscript/agent/claude-lmstudio.shscript/macos/agent-select-input-source.shscript/macos/select-input-source.swiftscript/macos/send-ime-key.shscript/macos/send-ime-key.swifttest/nix-darwin-config.test.js
💤 Files with no reviewable changes (5)
- dot/config/agent-deck/config.toml
- dot/config/codespaces-secrets/repos.txt
- credentials/templates/mcp.env.template
- credentials/templates/devcontainer.env.template
- script/macos/select-input-source.swift
| for cli in claude lms; do | ||
| if ! command -v "$cli" >/dev/null 2>&1; then | ||
| echo "claude-lmstudio: '${cli}' CLI not found in PATH" >&2 | ||
| exit 1 | ||
| fi | ||
| done |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Add node to the required CLI check.
The script uses node to parse the output of lms ps --json (on line 67). Adding node to the fail-fast check ensures the script produces a clear error if Node.js is missing, rather than failing opaquely during execution.
💻 Proposed fix
-for cli in claude lms; do
+for cli in claude lms node; do
if ! command -v "$cli" >/dev/null 2>&1; then
echo "claude-lmstudio: '${cli}' CLI not found in PATH" >&2
exit 1📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| for cli in claude lms; do | |
| if ! command -v "$cli" >/dev/null 2>&1; then | |
| echo "claude-lmstudio: '${cli}' CLI not found in PATH" >&2 | |
| exit 1 | |
| fi | |
| done | |
| for cli in claude lms node; do | |
| if ! command -v "$cli" >/dev/null 2>&1; then | |
| echo "claude-lmstudio: '${cli}' CLI not found in PATH" >&2 | |
| exit 1 | |
| fi | |
| done |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@script/agent/claude-lmstudio.sh` around lines 46 - 51, Update the required
CLI validation loop in the claude-lmstudio script to include node alongside
claude and lms, so the script exits with the existing clear PATH error before
attempting the node-based JSON parsing.
| data_home="${XDG_DATA_HOME:-${HOME}/.local/share}" | ||
| src="${data_home}/input-source/send-ime-key.swift" | ||
|
|
||
| exec /usr/bin/xcrun swift "$src" "$@" |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win
Pre-compile the Swift script to eliminate execution latency.
Invoking xcrun swift compiles the script on the fly on every execution, which typically introduces a noticeable delay (~200–500ms). For a human-facing IME switching shortcut, this latency is highly disruptive—characters typed immediately after pressing the shortcut can be sent to the active application before the input mode finishes switching.
Consider pre-compiling the Swift script into a binary (e.g., using swiftc -O during a build/setup phase or caching it on the first run) and executing the compiled binary directly to ensure instantaneous switching.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@script/macos/send-ime-key.sh` at line 7, Update the send-ime-key.sh execution
flow to avoid invoking xcrun swift on every run; compile the Swift source with
swiftc -O during setup or a first-run cache step, then execute the resulting
binary directly while preserving the existing "$src" "$@" arguments.
コンフリクト解決: - IME切替は send-ime-key(かな/英数キー発行)を維持(main の select-input-source を置換) - main の Dock/メニューバー/AeroSpace/BTT/Kanary caps制御 と関連テストを取り込み - docs/adr(0016,README)・nix/home/default.nix・input-source.nix を統合 - .zsh/configs/pre/devcontainer-env.zsh を allowlist 外部ファイル方式に更新 (main が zsh.nix とテストで導入済みの改修の生スクリプト側対応。組織固有キー名を公開ファイルから除去) - AGENTS.md / .claude/hooks/README.md を prettier 整形
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
AGENTS.md (1)
151-156: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winRegenerate this section instead of editing
AGENTS.mddirectly.Lines 151-156 are inside the
BEGIN AUTO-GENERATED/END AUTO-GENERATEDblock. Update the generator/source used by/repo-maintenance, then regenerate this file so future maintenance does not overwrite the change.As per coding guidelines, “Do not edit the auto-generated section between
BEGIN AUTO-GENERATEDandEND AUTO-GENERATEDmanually.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@AGENTS.md` around lines 151 - 156, Update the repository-maintenance generator/source that produces the command table containing format:check, lint, test, and shellcheck, rather than editing the generated AGENTS.md block directly; then regenerate AGENTS.md so the change is preserved.Source: Coding guidelines
.claude/hooks/README.md (1)
176-189: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winKeep Markdown table delimiters distinct from literal pipe characters.
Both changed tables declare inconsistent column counts and treat literal regex/shell pipes as column separators, which can misrender the documented mappings and commands.
.claude/hooks/README.md#L176-L189: reduce the separator row to two columns and escape every regex alternation pipe.AGENTS.md#L151-L156: reduce the separator row to three columns and escape the shell pipeline pipe; preserve the exactpackage.jsoncommand, including*.sh.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.claude/hooks/README.md around lines 176 - 189, The Markdown tables in .claude/hooks/README.md (lines 176-189) and AGENTS.md (lines 151-156) use inconsistent delimiters that misinterpret literal pipes as columns. In .claude/hooks/README.md, make the separator row two columns and escape every regex alternation pipe; in AGENTS.md, make the separator row three columns and escape the shell pipeline pipe while preserving the exact package.json command, including *.sh.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In @.claude/hooks/README.md:
- Around line 176-189: The Markdown tables in .claude/hooks/README.md (lines
176-189) and AGENTS.md (lines 151-156) use inconsistent delimiters that
misinterpret literal pipes as columns. In .claude/hooks/README.md, make the
separator row two columns and escape every regex alternation pipe; in AGENTS.md,
make the separator row three columns and escape the shell pipeline pipe while
preserving the exact package.json command, including *.sh.
In `@AGENTS.md`:
- Around line 151-156: Update the repository-maintenance generator/source that
produces the command table containing format:check, lint, test, and shellcheck,
rather than editing the generated AGENTS.md block directly; then regenerate
AGENTS.md so the change is preserved.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0faa799f-82a4-454e-82bf-8e46389a202c
📒 Files selected for processing (6)
.claude/hooks/README.md.zsh/configs/pre/devcontainer-env.zshAGENTS.mddocs/adr/0016-use-kanary-for-keyboard-remapping.mdnix/hosts/darwin/default.nixtest/nix-darwin-config.test.js
|
(aside) |
AGENTS.md(生成物)のコンフリクトは main 再生成版を採用し prettier 整形
|
Claude finished @keito4's task in 17m 11s —— View job コンフリクト解消状況
わかったこと
対応できたこと・できなかったこと
推奨する次のアクション(人手での適用推奨)
| Script | Command | Purpose |
| -------------- | ------------------------------------------------------------ | -------------------------- |
| `format:check` | `prettier --check .` | Code formatting validation |
| `lint` | `eslint . --ext .js` | Code quality validation |
| `test` | `jest --runInBand` | Unit test execution |
| `shellcheck` | `find script -name '*.sh' -type f \| xargs -r shellcheck -x` | Shell script validation |
Additional test commands: `test:integration` (BATS), `test:coverage` (Jest + coverage), `test:all` (unit + integration)
適用後 |
|
(aside) 失敗したチェック: Quality Gate, Lint & Format ログを確認して修正してください。コード変更で直せない種類(dependabot-auto / CodeQL / claude-review / 外部サービス等)の場合は、その旨と理由を1行で返信してください。 |
|
Claude finished @keito4's task in 10m 50s —— View job CI失敗の調査・対応
原因
Markdown テーブル内にエスケープされていない
いずれも今回のPRでの base ブランチ再マージ(コンフリクト解消)時に紛れ込んだもので、 対応できたこと
対応できなかったこと(要人手対応)
結果として、修正内容はローカルにのみ存在し、コミット・プッシュができていません。 推奨する次のアクション(人手での適用推奨)
**検出するパターン**:
| パターン | ラベル |
| ----------------------------------------- | ----------------------------- |
| `(AKIA\|ASIA)[0-9A-Z]{16}` | AWS アクセスキー ID |
| `aws_secret_access_key=...` | AWS シークレットアクセスキー |
| `ghp_...` / `gho_...` / `github_pat_...` | GitHub トークン(3種) |
| `sk-ant-...` | Anthropic API キー |
| `sk-proj-...` / `sk-...` | OpenAI キー |
| `xox[baprs]-...` | Slack トークン |
| `[sr]k_(live\|test)_...` | Stripe キー |
| `lin_api_...` | Linear API キー |
| `AIza...` | Google API キー |
| `glpat-...` | GitLab PAT |
| `dp.(pt\|st\|sa\|ct\|scim\|audit)....` | Doppler トークン |
| `-----BEGIN ... PRIVATE KEY-----` | 秘密鍵 |適用後、 --- a/script/update-agents-md.sh
+++ b/script/update-agents-md.sh
@@ -27,8 +27,12 @@ fi
emit() {
local -n out_ref=$1
shift
+ local args=("$@") i
+ for i in "${!args[@]}"; do
+ args[i]="${args[i]//|/\\|}"
+ done
local IFS=$'\x1f'
- local joined="$*"
+ local joined="${args[*]}"
out_ref+="| ${joined//$'\x1f'/ | } |"$'\n'
}
| Script | Command | Purpose |
| -------------- | ------------------------------------------------------------ | --------------------------- |
| `format:check` | `prettier --check .` | Code formatting validation |
| `lint` | `eslint . --ext .js` | Code quality validation |
| `test` | `jest --runInBand` | Unit test execution |
| `shellcheck` | `find script -name '*.sh' -type f \| xargs -r shellcheck -x` | Shell script validation |
Additional test commands: `test:integration` (BATS), `test:coverage` (Jest + coverage), `test:all` (unit + integration)( なお |
|
(aside) 失敗したチェック: Quality Gate, Lint & Format ログを確認して修正してください。コード変更で直せない種類(dependabot-auto / CodeQL / claude-review / 外部サービス等)の場合は、その旨と理由を1行で返信してください。 |
|
Claude finished @keito4's task in 12m 44s —— View job CI失敗の調査・対応
原因(過去2回のコメントと同一事象)
今回追加で対応できたこと(過去2回との差分)過去のセッションは
検証済み:
対応できなかったこと(
|
|
(aside) 失敗したチェック: Quality Gate, Lint & Format ログを確認して修正してください。コード変更で直せない種類(dependabot-auto / CodeQL / claude-review / 外部サービス等)の場合は、その旨と理由を1行で返信してください。 |
|
Claude finished @keito4's task in 7m 57s —— View job CI失敗の調査・対応(3回目)
原因(過去2回と同一)
今回できたこと
これらは
|
マージで prettier 3.9.5 に更新されたが 2 ファイルが旧整形のまま残り CI の Lint & Format が失敗していたため再整形
|
🎉 This PR is included in version 1.125.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Why
macOS の日本語入力切り替え(
Ctrl+Shift+J/Ctrl+Shift+;)で、ツールチップは日本語(ひらがな Google)に変わるのに実際の入力は英語のままになる事象があった。原因は skhd からTISSelectInputSourceで同一 Google IME 内のモード(base↔Roman)を選択していたため。モード切替はメニュー表示だけ更新し、動作中の IME に変換モード変更を通知しないという macOS の既知の挙動。あわせて Qwen3-Coder-Next 対応の claude-lmstudio ランチャーと Playwright アーティファクトの整理を同梱。What
TISSelectInputSource(モード選択)から物理かな/英数キーの発行(send-ime-key, CGEvent keycode 104/102)へ差し替え。Kanary の Cmd タップと同じ確実な HID 経路に統一。script/macos/send-ime-key.swift/send-ime-key.sh(新規)nix/home/input-source.nix・nix/hosts/darwin/default.nixを更新、select-input-source(TIS版)はエージェントの照会・選択用途で存置test/nix-darwin-config.test.jsを更新+新規テスト追加script/agent/claude-lmstudio.sh,nix/home/agent-commands.nix).prettierignore)+不要になった credential テンプレート等を削除How to verify
darwin-rebuild switch --flake ~/develop/github.com/keito4/config/nix再ビルド後、
Ctrl+Shift+Jを押してメニューバー表示だけでなく実際に打鍵した文字が日本語になるかを確認する。Risk
darwin-rebuild後にしか検証できない(上記 TCC 制約)。フォールバック手順は ADR に明記済み。Summary by CodeRabbit
New Features
claude-lmstudiocommand for running Claude against a local LM Studio model, including automatic model and context management.Bug Fixes
Chores