cckeep 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ja.md +29 -3
- package/README.md +33 -3
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -43,6 +43,14 @@ npx cckeep # いま何が見えているか
|
|
|
43
43
|
npx cckeep doctor # tmux・ペイン・スケジューラの確認
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
**インストール直後に `command not found: cckeep` と出たら**、shim 方式のバージョン管理ツールを使っています。`nodenv` や `asdf` は新しく入った実行ファイルを PATH に出すのに rehash が必要で、`nvm` はシェルを開き直す必要があります。
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
nodenv rehash # nodenv
|
|
50
|
+
asdf reshim nodejs # asdf
|
|
51
|
+
# nvm: 新しいシェルを開くだけ
|
|
52
|
+
```
|
|
53
|
+
|
|
46
54
|
条件が一つあります。**Claude Code が tmux の中で動いていること。** 素のターミナルで起動したセッションには別プロセスから入力を送る手段がなく、どんなツールでも手が出せません。→ [tmux で Claude Code を動かす](#tmux-で-claude-code-を動かす)
|
|
47
55
|
|
|
48
56
|
> 机に戻る手間が省けたなら、⭐ が同じ問題を抱えている人に届く助けになります。
|
|
@@ -104,13 +112,31 @@ cc() {
|
|
|
104
112
|
esac
|
|
105
113
|
done
|
|
106
114
|
local session="claude-$(basename "$PWD")-$(printf '%s' "$PWD" | cksum | cut -d' ' -f1)"
|
|
107
|
-
if [ -n "$TMUX" ]; then command claude "$@"
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
if [ -n "$TMUX" ]; then command claude "$@"; return; fi
|
|
116
|
+
if ! tmux has-session -t "=$session" 2>/dev/null; then
|
|
117
|
+
tmux new-session -s "$session" -c "$PWD" claude "$@"; return
|
|
110
118
|
fi
|
|
119
|
+
|
|
120
|
+
# tmux セッションは中の claude より長生きするので、そのままアタッチすると
|
|
121
|
+
# 会話が消えた素のシェルに落ちることがある。その場合は会話を呼び戻す。
|
|
122
|
+
local pane_cmd cmd
|
|
123
|
+
pane_cmd=$(tmux list-panes -t "=$session:" -F '#{pane_current_command}' 2>/dev/null | head -1)
|
|
124
|
+
case "$pane_cmd" in
|
|
125
|
+
zsh|bash|sh|fish)
|
|
126
|
+
cmd="claude"
|
|
127
|
+
case " $* " in
|
|
128
|
+
*" -c "*|*" --continue "*|*" -r "*|*" --resume "*|*" --session-id "*) ;;
|
|
129
|
+
*) cmd="$cmd --continue" ;;
|
|
130
|
+
esac
|
|
131
|
+
[ $# -gt 0 ] && cmd="$cmd $*"
|
|
132
|
+
tmux send-keys -t "=$session:" "$cmd" C-m ;;
|
|
133
|
+
esac
|
|
134
|
+
tmux attach-session -t "=$session"
|
|
111
135
|
}
|
|
112
136
|
```
|
|
113
137
|
|
|
138
|
+
`cc -c` と `cc --continue` はそのまま使えます — フラグは Claude Code にそのまま渡ります。上のブロックが埋めるのは、フラグでは救えないケース(tmux セッションだけ残って中の Claude Code が終了している状態)です。
|
|
139
|
+
|
|
114
140
|
あわせて `~/.tmux.conf` に2行必要です。これが無いと tmux 内で Shift+Enter とデスクトップ通知が壊れます([公式の案内](https://code.claude.com/docs/en/terminal-config#configure-tmux))。
|
|
115
141
|
|
|
116
142
|
```sh
|
package/README.md
CHANGED
|
@@ -43,6 +43,16 @@ npx cckeep # what it sees right now
|
|
|
43
43
|
npx cckeep doctor # check tmux, panes, and the scheduler
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
**`command not found: cckeep` right after installing?** You are on a shim-based
|
|
47
|
+
version manager. `nodenv` and `rbenv`-style setups need a rehash before a newly
|
|
48
|
+
installed binary appears on `PATH`, and `nvm` needs a new shell:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
nodenv rehash # nodenv
|
|
52
|
+
asdf reshim nodejs # asdf
|
|
53
|
+
# nvm: just open a new shell
|
|
54
|
+
```
|
|
55
|
+
|
|
46
56
|
One requirement: **Claude Code has to be running inside tmux.** A session started in a bare terminal cannot be reached from another process, so there is nothing any tool can do for it. See [Running Claude Code in tmux](#running-claude-code-in-tmux).
|
|
47
57
|
|
|
48
58
|
> If cckeep saved you a walk back to your desk, a ⭐ helps other Remote Control users find it.
|
|
@@ -104,13 +114,33 @@ cc() {
|
|
|
104
114
|
esac
|
|
105
115
|
done
|
|
106
116
|
local session="claude-$(basename "$PWD")-$(printf '%s' "$PWD" | cksum | cut -d' ' -f1)"
|
|
107
|
-
if [ -n "$TMUX" ]; then command claude "$@"
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
if [ -n "$TMUX" ]; then command claude "$@"; return; fi
|
|
118
|
+
if ! tmux has-session -t "=$session" 2>/dev/null; then
|
|
119
|
+
tmux new-session -s "$session" -c "$PWD" claude "$@"; return
|
|
110
120
|
fi
|
|
121
|
+
|
|
122
|
+
# The tmux session outlives the claude process inside it, so attaching can
|
|
123
|
+
# drop you at a bare shell with the conversation gone. Bring it back.
|
|
124
|
+
local pane_cmd cmd
|
|
125
|
+
pane_cmd=$(tmux list-panes -t "=$session:" -F '#{pane_current_command}' 2>/dev/null | head -1)
|
|
126
|
+
case "$pane_cmd" in
|
|
127
|
+
zsh|bash|sh|fish)
|
|
128
|
+
cmd="claude"
|
|
129
|
+
case " $* " in
|
|
130
|
+
*" -c "*|*" --continue "*|*" -r "*|*" --resume "*|*" --session-id "*) ;;
|
|
131
|
+
*) cmd="$cmd --continue" ;;
|
|
132
|
+
esac
|
|
133
|
+
[ $# -gt 0 ] && cmd="$cmd $*"
|
|
134
|
+
tmux send-keys -t "=$session:" "$cmd" C-m ;;
|
|
135
|
+
esac
|
|
136
|
+
tmux attach-session -t "=$session"
|
|
111
137
|
}
|
|
112
138
|
```
|
|
113
139
|
|
|
140
|
+
`cc -c` and `cc --continue` work as you'd expect — the flag is passed straight
|
|
141
|
+
through to Claude Code. The block above covers the case the flag can't: a tmux
|
|
142
|
+
session whose Claude Code process has already exited.
|
|
143
|
+
|
|
114
144
|
Claude Code also needs two lines in `~/.tmux.conf`, or Shift+Enter and desktop notifications break inside tmux ([official guidance](https://code.claude.com/docs/en/terminal-config#configure-tmux)):
|
|
115
145
|
|
|
116
146
|
```sh
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cckeep",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Keeps Claude Code Remote Control from silently going dead. Re-arms the sessions its 31-second retry budget gives up on — local, tmux-native, zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|