Skip to content

Add /cc:<command> to forward Claude Code slash commands (v0.1.20)#32

Merged
t2tx merged 2 commits into
mainfrom
feature/cc-prefix
Jun 28, 2026
Merged

Add /cc:<command> to forward Claude Code slash commands (v0.1.20)#32
t2tx merged 2 commits into
mainfrom
feature/cc-prefix

Conversation

@t2tx

@t2tx t2tx commented Jun 28, 2026

Copy link
Copy Markdown
Owner

概要

Iris 自身のコマンドは / 名前空間(/help /status …)を使うため、Claude Code 側のスラッシュコマンドを Iris 経由で叩けませんでした。/cc: エスケープを追加します。

/cc:mycommand arg のように送ると、Iris は /cc: を剥がして /mycommand arg を既存の forwardToClaude 経路でセッションの Claude プロセスへ転送します。

仕様

  • カスタムコマンド / スキル(.claude/commands/*.md)は stream-json モードで Claude が展開するため 動作する
  • 組み込みの対話コマンド(/context /compact /clear /cost 等)は headless モードで利用不可のため 何も起きない/help と usage hint に明記)。
  • Iris の既存コマンドとは名前空間が分離(例: /cc:help は Iris の /help ではなく Claude の /help を転送)。

検証

  • 実機(dev、DM + チャンネル mention 両方): 一時カスタムコマンド /cc:iris-cctest を送り、Claude が展開・実行してコマンド本文どおりの出力を返すことを確認。
  • pnpm verify 全通過、122 tests pass(/cc: の挙動テスト 4 件追加)。

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for /cc:<command> [args] to forward custom commands directly to Claude Code.
    • Updated command help text to document the new /cc:<command> syntax and clarify headless limitations.
  • Bug Fixes
    • Improved /cc:help handling so it forwards correctly rather than triggering Iris’s own help flow.
    • When entering /cc: without a command, it now returns a clear usage/help message.
  • Documentation
    • Updated the command list and /cc: behavior in both README.md and README.ja.md.
  • Tests
    • Added unit tests covering /cc:<command> forwarding and /cc: usage behavior.
  • Chores
    • Bumped the package version to 0.1.20.

Iris's own commands use the `/` namespace (/help, /status, …), so Claude Code's
own slash commands could not be invoked through Iris. Add a `/cc:` escape: a
message like `/cc:mycommand arg` strips the prefix and forwards `/mycommand arg`
to the session's Claude process via the existing forwardToClaude path.

Custom commands and skills (.claude/commands/*.md) are expanded by Claude in
stream-json mode, so they work. Built-in interactive commands (/context,
/compact, …) are not available in headless mode and will not do anything —
documented in /help and the usage hint.

Verified in dev (DM + channel mention): `/cc:iris-cctest` ran a custom command
and returned its output.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: eb2d70ea-e56b-4a1f-90f7-94db8228d43a

📥 Commits

Reviewing files that changed from the base of the PR and between 0f2a024 and dfe9bb4.

📒 Files selected for processing (2)
  • README.ja.md
  • README.md

Walkthrough

Adds /cc:<command> [args] handling in src/commands.ts to forward commands to Claude Code, with a usage response for bare /cc:. Help text, tests, and the package version are updated.

/cc: Command Forwarding

Layer / File(s) Summary
Prefix detection and forwarding
src/commands.ts
Defines CC_PREFIX, extends handleCommand to parse /cc:<rest>, returns usage text for bare /cc:, and forwards the remainder to Claude as /<rest>. Adds /cc:<command> [args] to cmdHelp().
Forwarding tests
src/commands.test.ts
Adds unit tests for argument forwarding, /cc:help behavior, and bare /cc: returning usage without forwarding.
Version bump
package.json
Bumps version from 0.1.19 to 0.1.20.

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • t2tx/iris#13: Modifies the same handleCommand slash-command routing in src/commands.ts, adding a /switch command via a similar dispatch path.
  • t2tx/iris#17: Also updates src/commands.ts and src/commands.test.ts to extend slash-command handling and /help output.
  • t2tx/iris#20: Adds slash-command forwarding to Claude using the same forwardToClaude mechanism in src/commands.ts and tests it in src/commands.test.ts.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: adding /cc: forwarding for Claude Code slash commands.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/cc-prefix

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@t2tx t2tx merged commit e70ca8c into main Jun 28, 2026
5 checks passed
@t2tx t2tx deleted the feature/cc-prefix branch June 28, 2026 06:06
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.

1 participant