cckeep 0.1.2 → 0.2.0
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 +8 -6
- package/README.md +8 -6
- package/bin/cckeep.js +11 -7
- package/package.json +1 -1
- package/src/commands.js +35 -0
- package/src/config.js +1 -1
- package/src/i18n.js +8 -8
package/README.ja.md
CHANGED
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
npm install -g cckeep
|
|
32
|
-
cckeep
|
|
32
|
+
cckeep enable
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
`npm install` は CLI を `PATH` に置くだけで、常駐はまだ始まりません。`cckeep enable` がバックグラウンドジョブを登録します(macOS は launchd、Linux は systemd user timer)。15秒ごとに確認し、死んでいるものを繋ぎ直します。
|
|
36
36
|
|
|
37
|
-
`npx cckeep
|
|
37
|
+
`npx cckeep enable` ではなくグローバルに入れてください。登録されたジョブはインストール先の cckeep を実行しますが、npx のキャッシュは使い捨てです。そこを指すジョブはキャッシュが消された瞬間に、黙って動かなくなります — 監視ツールが持ってはいけない唯一の壊れ方です。そのため `cckeep enable` は npx のパスからの登録を拒否します。
|
|
38
38
|
|
|
39
39
|
入れる前に様子を見るだけなら `npx` で構いません。以下の2つは何も変更しません。
|
|
40
40
|
|
|
@@ -85,14 +85,16 @@ asdf reshim nodejs # asdf
|
|
|
85
85
|
cckeep # 状態表示: Claude Code のペインごとに1行
|
|
86
86
|
cckeep watch # スケジュール登録せずフォアグラウンドで実行
|
|
87
87
|
cckeep once # 1回だけ実行(スケジューラが叩くもの)
|
|
88
|
-
cckeep
|
|
89
|
-
cckeep
|
|
88
|
+
cckeep enable # バックグラウンドでの監視を開始
|
|
89
|
+
cckeep disable # 監視を停止
|
|
90
90
|
cckeep doctor # tmux・ペイン・スケジューラ・各パス
|
|
91
91
|
cckeep logs # これまでの動作
|
|
92
92
|
```
|
|
93
93
|
|
|
94
94
|
オプション: `--dry-run`、`--json`、`--interval <秒>`、`--lang en|ja`(`LANG` から自動判定)。
|
|
95
95
|
|
|
96
|
+
`install` / `uninstall` は `enable` / `disable` のエイリアスとして引き続き使えます。
|
|
97
|
+
|
|
96
98
|
## tmux で Claude Code を動かす
|
|
97
99
|
|
|
98
100
|
cckeep は tmux ペインを読み、そこに入力します。動いている Claude Code セッションに別プロセスから届く経路はこれだけで、だからこそ tmux 内での起動が必要です。プロセスの再起動は代替になりません — 会話が終わってしまい、守りたかったものそのものを失うからです。
|
|
@@ -162,7 +164,7 @@ Ctrl+B の衝突は対処不要です。Claude Code は tmux を検出して、
|
|
|
162
164
|
}
|
|
163
165
|
```
|
|
164
166
|
|
|
165
|
-
- `interval` — 巡回間隔(秒)。`
|
|
167
|
+
- `interval` — 巡回間隔(秒)。`enable` が登録する間隔でもある
|
|
166
168
|
- `cooldown` — 同じペインに再度手を出せるまでの秒数
|
|
167
169
|
- `stuckLimit` — `reconnecting` が何回続いたら固着とみなすか
|
|
168
170
|
- `missLimit` — 表示のあったペインが何回無表示なら繋ぎ直すか
|
package/README.md
CHANGED
|
@@ -29,12 +29,12 @@ Either way you find out the same way: you reach for your phone, and the session
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
npm install -g cckeep
|
|
32
|
-
cckeep
|
|
32
|
+
cckeep enable
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
`npm install` only puts the CLI on your `PATH`; `cckeep enable` is the step that registers a background job — launchd on macOS, a systemd user timer on Linux — that checks every 15 seconds and re-arms whatever went dead.
|
|
36
36
|
|
|
37
|
-
Install it globally rather than running `npx cckeep
|
|
37
|
+
Install it globally rather than running `npx cckeep enable`. The scheduled job runs cckeep from wherever it was installed, and npx's cache is throwaway: a job pointing into it keeps working until the cache is cleared and then stops, silently — the one failure a watchdog must not have. `cckeep enable` refuses to schedule from an npx path for that reason.
|
|
38
38
|
|
|
39
39
|
To look before installing anything, `npx` is fine — neither of these changes a thing:
|
|
40
40
|
|
|
@@ -87,14 +87,16 @@ This is the whole design problem. A watchdog that types into your terminal on a
|
|
|
87
87
|
cckeep # status: one line per Claude Code pane
|
|
88
88
|
cckeep watch # run in the foreground instead of scheduling
|
|
89
89
|
cckeep once # a single pass — what the scheduler runs
|
|
90
|
-
cckeep
|
|
91
|
-
cckeep
|
|
90
|
+
cckeep enable # start checking in the background
|
|
91
|
+
cckeep disable # stop checking
|
|
92
92
|
cckeep doctor # tmux, panes, scheduler, paths
|
|
93
93
|
cckeep logs # what it has done
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Options: `--dry-run`, `--json`, `--interval <s>`, `--lang en|ja` (auto-detected from `LANG`).
|
|
97
97
|
|
|
98
|
+
`install` and `uninstall` still work as aliases for `enable` and `disable`.
|
|
99
|
+
|
|
98
100
|
## Running Claude Code in tmux
|
|
99
101
|
|
|
100
102
|
cckeep reads and types into tmux panes. That is the only channel a separate process has into a live Claude Code session — and it is why the session must be started inside tmux. Restarting the process is not an alternative: it would end the conversation, which is exactly what you are trying to save.
|
|
@@ -166,7 +168,7 @@ Defaults are tuned so you never notice it. Override in `~/.cckeep/config.json`,
|
|
|
166
168
|
}
|
|
167
169
|
```
|
|
168
170
|
|
|
169
|
-
- `interval` — seconds between passes (also what `
|
|
171
|
+
- `interval` — seconds between passes (also what `enable` schedules)
|
|
170
172
|
- `cooldown` — seconds before the same pane may be acted on again
|
|
171
173
|
- `stuckLimit` — checks in `reconnecting` before the bridge is treated as wedged
|
|
172
174
|
- `missLimit` — checks with no indicator before re-arming a pane that had one
|
package/bin/cckeep.js
CHANGED
|
@@ -7,6 +7,7 @@ import { logPath, statePath, homeDir } from '../src/state.js';
|
|
|
7
7
|
import * as tmux from '../src/tmux.js';
|
|
8
8
|
import * as scheduler from '../src/scheduler.js';
|
|
9
9
|
import { pickLang, strings } from '../src/i18n.js';
|
|
10
|
+
import { resolveCommand } from '../src/commands.js';
|
|
10
11
|
|
|
11
12
|
const HELP = `cckeep — keep Claude Code Remote Control from silently going dead
|
|
12
13
|
|
|
@@ -17,11 +18,14 @@ COMMANDS
|
|
|
17
18
|
status what cckeep sees right now (default)
|
|
18
19
|
watch run in the foreground, one pass every --interval seconds
|
|
19
20
|
once a single pass — what the scheduler runs
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
enable start checking in the background (launchd / systemd user timer)
|
|
22
|
+
disable stop checking
|
|
22
23
|
doctor check tmux, Claude Code panes, and the scheduler
|
|
23
24
|
logs show recent actions
|
|
24
25
|
|
|
26
|
+
"npm install -g cckeep" only puts this CLI on your PATH. "cckeep enable" is
|
|
27
|
+
what registers the background job. (install / uninstall still work as aliases.)
|
|
28
|
+
|
|
25
29
|
OPTIONS
|
|
26
30
|
--interval <s> seconds between passes (default 15)
|
|
27
31
|
--dry-run report what would be sent, send nothing
|
|
@@ -107,7 +111,7 @@ async function main() {
|
|
|
107
111
|
process.exit(1);
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
switch (opts.command
|
|
114
|
+
switch (resolveCommand(opts.command)) {
|
|
111
115
|
case 'status': {
|
|
112
116
|
const out = await runPass({ config, dryRun: true });
|
|
113
117
|
render(out, t, opts);
|
|
@@ -128,7 +132,7 @@ async function main() {
|
|
|
128
132
|
await new Promise((r) => setTimeout(r, config.interval * 1000));
|
|
129
133
|
}
|
|
130
134
|
}
|
|
131
|
-
case '
|
|
135
|
+
case 'enable': {
|
|
132
136
|
const res = scheduler.install({ interval: config.interval });
|
|
133
137
|
if (res.kind === 'ephemeral') {
|
|
134
138
|
console.error(t.ephemeral(res.path));
|
|
@@ -138,14 +142,14 @@ async function main() {
|
|
|
138
142
|
console.log(t.unsupported);
|
|
139
143
|
process.exit(1);
|
|
140
144
|
}
|
|
141
|
-
console.log(res.ok ? t.
|
|
145
|
+
console.log(res.ok ? t.enabled(res.kind, res.path) : t.enableFailed(res.kind));
|
|
142
146
|
if (!res.ok) process.exit(1);
|
|
143
147
|
break;
|
|
144
148
|
}
|
|
145
|
-
case '
|
|
149
|
+
case 'disable': {
|
|
146
150
|
const res = scheduler.uninstall();
|
|
147
151
|
if (res.kind === 'unsupported') return console.log(t.unsupported);
|
|
148
|
-
console.log(t.
|
|
152
|
+
console.log(t.disabled(res.kind));
|
|
149
153
|
break;
|
|
150
154
|
}
|
|
151
155
|
case 'doctor': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cckeep",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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": {
|
package/src/commands.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `npm install -g cckeep` puts the CLI on your PATH; registering the background
|
|
3
|
+
* job is a separate, deliberate step. Naming that step `install` too made the
|
|
4
|
+
* quick start read as if you were installing twice, so the scheduler verbs are
|
|
5
|
+
* `enable` / `disable` — the same words systemctl uses for the same idea.
|
|
6
|
+
*
|
|
7
|
+
* The old names stay as aliases: they shipped in 0.1.x and in the plists people
|
|
8
|
+
* already generated, and breaking them buys nothing.
|
|
9
|
+
*/
|
|
10
|
+
export const ALIASES = {
|
|
11
|
+
install: 'enable',
|
|
12
|
+
uninstall: 'disable',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const COMMANDS = new Set([
|
|
16
|
+
'status',
|
|
17
|
+
'watch',
|
|
18
|
+
'once',
|
|
19
|
+
'enable',
|
|
20
|
+
'disable',
|
|
21
|
+
'doctor',
|
|
22
|
+
'logs',
|
|
23
|
+
'help',
|
|
24
|
+
'version',
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
/** Map whatever the user typed onto a canonical command. */
|
|
28
|
+
export function resolveCommand(input) {
|
|
29
|
+
const name = input ?? 'status';
|
|
30
|
+
return ALIASES[name] ?? name;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function isKnownCommand(input) {
|
|
34
|
+
return COMMANDS.has(resolveCommand(input));
|
|
35
|
+
}
|
package/src/config.js
CHANGED
|
@@ -5,7 +5,7 @@ import { DEFAULTS } from './detect.js';
|
|
|
5
5
|
|
|
6
6
|
export const BASE = {
|
|
7
7
|
...DEFAULTS,
|
|
8
|
-
/** Seconds between passes in watch mode, and what `
|
|
8
|
+
/** Seconds between passes in watch mode, and what `enable` schedules. */
|
|
9
9
|
interval: 15,
|
|
10
10
|
/** Milliseconds between the two captures of the idle check. */
|
|
11
11
|
settle: 2000,
|
package/src/i18n.js
CHANGED
|
@@ -17,11 +17,11 @@ const en = {
|
|
|
17
17
|
wouldRearm: 'would re-arm',
|
|
18
18
|
wouldConfirm: 'would cycle bridge',
|
|
19
19
|
watching: (n) => `Watching every ${n}s. Ctrl+C to stop.`,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
enabled: (kind, path) => `Enabled (${kind}): ${path}`,
|
|
21
|
+
enableFailed: (kind) => `Wrote the ${kind} unit, but could not load it. Load it manually, or run \`cckeep watch\` in a terminal.`,
|
|
22
|
+
disabled: (kind) => `Disabled — removed the ${kind} job.`,
|
|
23
23
|
unsupported: 'Automatic scheduling supports macOS (launchd) and Linux (systemd user timers). Elsewhere, run `cckeep watch` under your own supervisor.',
|
|
24
|
-
ephemeral: (p) => `Refusing to schedule: this copy of cckeep lives in npm's throwaway npx cache\n ${p}\nA scheduled job pointing there stops working the moment the cache is cleared — silently. Install it properly first:\n\n npm install -g cckeep && cckeep
|
|
24
|
+
ephemeral: (p) => `Refusing to schedule: this copy of cckeep lives in npm's throwaway npx cache\n ${p}\nA scheduled job pointing there stops working the moment the cache is cleared — silently. Install it properly first:\n\n npm install -g cckeep && cckeep enable\n`,
|
|
25
25
|
scheduledPath: 'scheduled cmd',
|
|
26
26
|
scheduledMissing: 'MISSING — run `cckeep install` again',
|
|
27
27
|
noLog: 'No log yet.',
|
|
@@ -48,11 +48,11 @@ const ja = {
|
|
|
48
48
|
wouldRearm: '再接続を送信する',
|
|
49
49
|
wouldConfirm: 'ブリッジを張り直す',
|
|
50
50
|
watching: (n) => `${n} 秒ごとに監視します。Ctrl+C で停止。`,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
enabled: (kind, path) => `有効化しました (${kind}): ${path}`,
|
|
52
|
+
enableFailed: (kind) => `${kind} の定義は書きましたが、読み込みに失敗しました。手動で読み込むか、ターミナルで \`cckeep watch\` を実行してください。`,
|
|
53
|
+
disabled: (kind) => `無効化しました — ${kind} のジョブを削除しました。`,
|
|
54
54
|
unsupported: '自動スケジュール登録は macOS (launchd) と Linux (systemd user timer) に対応しています。それ以外では `cckeep watch` を任意の常駐手段で動かしてください。',
|
|
55
|
-
ephemeral: (p) => `登録を中止しました: この cckeep は npm の使い捨て npx キャッシュ内にあります\n ${p}\nここを指すジョブは、キャッシュが消された瞬間に黙って動かなくなります。先に正式にインストールしてください:\n\n npm install -g cckeep && cckeep
|
|
55
|
+
ephemeral: (p) => `登録を中止しました: この cckeep は npm の使い捨て npx キャッシュ内にあります\n ${p}\nここを指すジョブは、キャッシュが消された瞬間に黙って動かなくなります。先に正式にインストールしてください:\n\n npm install -g cckeep && cckeep enable\n`,
|
|
56
56
|
scheduledPath: '登録先',
|
|
57
57
|
scheduledMissing: '見つかりません — `cckeep install` を再実行してください',
|
|
58
58
|
noLog: 'ログはまだありません。',
|