@halooojustin/cch 0.1.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/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@halooojustin/cch",
3
+ "version": "0.1.0",
4
+ "description": "Claude Code History — AI-powered conversation history management with Zellij/tmux session support",
5
+ "type": "module",
6
+ "bin": {
7
+ "ch": "./bin/ch.js"
8
+ },
9
+ "main": "./dist/cli.js",
10
+ "scripts": {
11
+ "build": "node esbuild.config.mjs",
12
+ "dev": "tsx src/cli.ts",
13
+ "test": "node --test dist/**/*.test.js",
14
+ "typecheck": "tsc --noEmit"
15
+ },
16
+ "keywords": [
17
+ "claude",
18
+ "claude-code",
19
+ "history",
20
+ "session",
21
+ "zellij",
22
+ "tmux",
23
+ "cli"
24
+ ],
25
+ "license": "MIT",
26
+ "files": [
27
+ "dist/",
28
+ "bin/",
29
+ "skill/",
30
+ "README.md",
31
+ "README.zh-CN.md"
32
+ ],
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/user/cch"
36
+ },
37
+ "engines": {
38
+ "node": ">=18"
39
+ },
40
+ "dependencies": {
41
+ "commander": "^14.0.3"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "^25.5.0",
45
+ "esbuild": "^0.27.4",
46
+ "tsx": "^4.21.0",
47
+ "typescript": "^6.0.2"
48
+ }
49
+ }
package/skill/SKILL.md ADDED
@@ -0,0 +1,220 @@
1
+ ---
2
+ name: cch
3
+ description: 安装和配置 CCH (Claude Code History) — 跨项目对话历史管理 CLI 工具。当用户说"安装 cch"、"install cch"、"配置 cch"、"setup cch"、"/cch" 时使用。
4
+ allowed-tools: Bash, Read, AskUserQuestion
5
+ ---
6
+
7
+ # CCH — Claude Code History 安装配置
8
+
9
+ 帮助用户一键安装 CCH 及其所有前置依赖。
10
+
11
+ CCH 是一个**终端命令行工具**,安装完成后在 Claude Code 外面使用。
12
+
13
+ ## 触发词
14
+
15
+ - "安装 cch"、"install cch"
16
+ - "配置 cch"、"setup cch"
17
+ - "/cch"
18
+
19
+ ## 执行步骤
20
+
21
+ ### 1. 检测操作系统和包管理器
22
+
23
+ ```bash
24
+ uname -s
25
+ which brew || which apt-get || which yum
26
+ ```
27
+
28
+ - macOS:使用 Homebrew(如果没装 Homebrew,先装它)
29
+ - Linux (Debian/Ubuntu):使用 apt-get
30
+ - Linux (RHEL/CentOS):使用 yum
31
+
32
+ 如果是 macOS 且没有 Homebrew:
33
+
34
+ ```bash
35
+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
36
+ ```
37
+
38
+ ### 2. 安装 Node.js(如果需要)
39
+
40
+ ```bash
41
+ node --version 2>/dev/null || echo "NOT_INSTALLED"
42
+ ```
43
+
44
+ 如果没安装或版本 < 18:
45
+
46
+ **macOS:**
47
+ ```bash
48
+ brew install node
49
+ ```
50
+
51
+ **Linux (Debian/Ubuntu):**
52
+ ```bash
53
+ curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
54
+ sudo apt-get install -y nodejs
55
+ ```
56
+
57
+ 验证:
58
+ ```bash
59
+ node --version # 应该 >= 18
60
+ npm --version
61
+ ```
62
+
63
+ ### 3. 安装终端复用器(Zellij 或 tmux)
64
+
65
+ ```bash
66
+ which zellij 2>/dev/null || which tmux 2>/dev/null || echo "NONE_INSTALLED"
67
+ ```
68
+
69
+ 如果都没装,推荐 Zellij(更现代、无需额外配置):
70
+
71
+ **macOS:**
72
+ ```bash
73
+ brew install zellij
74
+ ```
75
+
76
+ **Linux:**
77
+ ```bash
78
+ bash <(curl -L zellij.dev/launch)
79
+ ```
80
+
81
+ 如果用户偏好 tmux:
82
+
83
+ **macOS:**
84
+ ```bash
85
+ brew install tmux
86
+ ```
87
+
88
+ **Linux:**
89
+ ```bash
90
+ sudo apt-get install -y tmux
91
+ ```
92
+
93
+ ### 4. 安装 Claude Code CLI(如果需要)
94
+
95
+ ```bash
96
+ which claude 2>/dev/null || echo "NOT_INSTALLED"
97
+ ```
98
+
99
+ 如果没装:
100
+
101
+ ```bash
102
+ npm install -g @anthropic-ai/claude-code
103
+ ```
104
+
105
+ 安装后需要用户登录一次:
106
+
107
+ ```bash
108
+ claude
109
+ ```
110
+
111
+ 提示用户按照终端里的指引完成认证。
112
+
113
+ ### 5. 安装 CCH
114
+
115
+ ```bash
116
+ npm install -g cch
117
+ ```
118
+
119
+ ### 6. 设置 shell 别名
120
+
121
+ ```bash
122
+ ch setup
123
+ ```
124
+
125
+ 会自动检测 zsh/bash,向对应的 rc 文件追加别名:
126
+
127
+ | 别名 | 等价于 | 说明 |
128
+ |------|--------|------|
129
+ | `cn` | `ch new` | 新建 Claude 会话 |
130
+ | `cnf` | `ch new -f` | 强制新建(先关旧的) |
131
+ | `cls` | `ch ls` | 浏览历史对话 |
132
+ | `cps` | `ch ps` | 查看活跃会话 |
133
+ | `chs` | `ch search` | 关键词搜索 |
134
+
135
+ ### 7. 生效配置
136
+
137
+ ```bash
138
+ source ~/.zshrc # 或 source ~/.bashrc
139
+ ```
140
+
141
+ ### 8. 验证安装
142
+
143
+ 逐项验证:
144
+
145
+ ```bash
146
+ ch --version # 应该输出版本号
147
+ ch ls # 应该显示历史对话列表(如果之前用过 Claude Code)
148
+ ch config # 应该显示配置信息
149
+ ```
150
+
151
+ ## 安装完成后
152
+
153
+ 告诉用户以下信息:
154
+
155
+ > CCH 安装完成!这是一个**终端命令行工具**,退出 Claude Code 后在终端里使用。
156
+ >
157
+ > 常用命令:
158
+ >
159
+ > | 命令 | 说明 |
160
+ > |------|------|
161
+ > | `cls` | 浏览历史对话,上下选择后 Enter 恢复 |
162
+ > | `cps` | 查看正在运行的会话,选择后 Enter 连接 |
163
+ > | `cn 描述` | 新建 Claude 会话(描述显示在 Zellij tab 名) |
164
+ > | `cnf` | 强制新建(先关掉同名旧会话) |
165
+ > | `ch 自然语言描述` | AI 搜索历史对话 |
166
+ > | `chs 关键词` | 精确搜索对话内容 |
167
+ >
168
+ > 所有会话在 Zellij/tmux 中运行,关掉终端也不丢失,随时可以用 `cps` 重新连接。
169
+
170
+ ## 故障排查
171
+
172
+ **`ch: command not found`**
173
+
174
+ npm 全局 bin 目录可能不在 PATH 中:
175
+
176
+ ```bash
177
+ npm root -g
178
+ npm bin -g
179
+ ```
180
+
181
+ 确保 `npm bin -g` 的输出路径在 PATH 中。如果用的是 nvm:
182
+
183
+ ```bash
184
+ echo $PATH | tr ':' '\n' | grep nvm
185
+ ```
186
+
187
+ **`ch ls` 没有显示任何历史**
188
+
189
+ ```bash
190
+ ls ~/.claude/projects/
191
+ ```
192
+
193
+ 如果目录为空或不存在,说明用户还没用过 Claude Code。先在几个项目里用 Claude Code 对话几次,历史就会出现。
194
+
195
+ **`ch new` 报错找不到 Zellij/tmux**
196
+
197
+ ```bash
198
+ which zellij && which tmux
199
+ ```
200
+
201
+ 安装一个复用器,或者手动指定后端:
202
+
203
+ ```bash
204
+ ch config set backend tmux # 如果装的是 tmux
205
+ ch config set backend zellij # 如果装的是 zellij
206
+ ```
207
+
208
+ **新建的会话里 Claude Code 要求重新登录**
209
+
210
+ 确认 Claude Code 在普通终端里可以正常使用:
211
+
212
+ ```bash
213
+ claude --version
214
+ ```
215
+
216
+ 如果普通终端没问题但 `ch new` 里要登录,检查 shell 配置是否正常加载:
217
+
218
+ ```bash
219
+ zsh -lc "echo \$PATH" | tr ':' '\n' | head
220
+ ```