claude-code-smart-fork 1.0.0 → 1.0.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.md +7 -5
- package/README.zh-CN.md +288 -14
- package/package.json +3 -1
- package/scripts/install.js +131 -0
package/README.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
🔀 **Smart session forking for Claude Code** - Find and resume relevant historical sessions across all your projects using AI-powered semantic search.
|
|
4
4
|
|
|
5
|
+
**[中文](README.zh-CN.md)** | **[English](README.md)**
|
|
6
|
+
|
|
5
7
|
[](https://www.npmjs.com/package/claude-code-smart-fork)
|
|
6
8
|
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
[](https://github.com/fjibj/claude-code-smart-fork/actions)
|
|
8
10
|
|
|
9
11
|
## 🌟 Features
|
|
10
12
|
|
|
@@ -262,7 +264,7 @@ All data is stored locally in `~/.smart-fork/`:
|
|
|
262
264
|
|
|
263
265
|
```bash
|
|
264
266
|
# Clone the repository
|
|
265
|
-
git clone https://github.com/
|
|
267
|
+
git clone https://github.com/fjibj/claude-code-smart-fork.git
|
|
266
268
|
cd claude-code-smart-fork
|
|
267
269
|
|
|
268
270
|
# Install dependencies
|
|
@@ -312,6 +314,6 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
312
314
|
|
|
313
315
|
## 📮 Support
|
|
314
316
|
|
|
315
|
-
- 🐛 [Report a bug](https://github.com/
|
|
316
|
-
- 💡 [Request a feature](https://github.com/
|
|
317
|
-
- 📧 Contact:
|
|
317
|
+
- 🐛 [Report a bug](https://github.com/fjibj/claude-code-smart-fork/issues)
|
|
318
|
+
- 💡 [Request a feature](https://github.com/fjibj/claude-code-smart-fork/issues)
|
|
319
|
+
- 📧 Contact: fjibj@users.noreply.github.com
|
package/README.zh-CN.md
CHANGED
|
@@ -1,34 +1,68 @@
|
|
|
1
|
-
# Claude Code Smart Fork
|
|
1
|
+
# Claude Code Smart Fork
|
|
2
2
|
|
|
3
3
|
🔀 **Claude Code 智能会话分支** - 使用 AI 驱动的语义搜索,在所有项目中查找并恢复相关的历史会话。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**[中文](README.zh-CN.md)** | **[English](README.md)**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/claude-code-smart-fork)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://github.com/fjibj/claude-code-smart-fork/actions)
|
|
10
|
+
|
|
11
|
+
## 🌟 功能特性
|
|
6
12
|
|
|
7
13
|
- 🔍 **语义搜索** - 基于含义而非关键词查找相关会话
|
|
8
14
|
- 🌐 **跨项目** - 在所有项目中搜索,不限于当前项目
|
|
9
15
|
- 🤖 **AI 驱动** - 使用嵌入向量理解上下文和意图
|
|
10
16
|
- ⚡ **快速** - 本地向量存储,即时返回结果
|
|
11
17
|
- 🔒 **隐私** - 默认所有数据保存在本地
|
|
18
|
+
- 🎯 **简易集成** - 作为 slash 命令无缝集成到 Claude Code
|
|
12
19
|
|
|
13
|
-
##
|
|
20
|
+
## 📦 安装
|
|
14
21
|
|
|
15
22
|
```bash
|
|
16
|
-
#
|
|
23
|
+
# 全局安装
|
|
17
24
|
npm install -g claude-code-smart-fork
|
|
18
25
|
|
|
19
|
-
#
|
|
26
|
+
# 或使用 npx(无需安装)
|
|
27
|
+
npx claude-code-smart-fork
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 🚀 快速开始
|
|
31
|
+
|
|
32
|
+
### 1. 索引当前会话
|
|
33
|
+
|
|
34
|
+
```bash
|
|
20
35
|
smart-fork index --summary "实现用户认证功能"
|
|
36
|
+
```
|
|
21
37
|
|
|
22
|
-
|
|
38
|
+
### 2. 查找相关会话
|
|
39
|
+
|
|
40
|
+
```bash
|
|
23
41
|
smart-fork detect
|
|
42
|
+
```
|
|
24
43
|
|
|
25
|
-
|
|
26
|
-
|
|
44
|
+
### 3. 切换到会话
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
smart-fork fork-to <session-id>
|
|
27
48
|
```
|
|
28
49
|
|
|
29
|
-
##
|
|
50
|
+
## 🛠️ 使用方法
|
|
51
|
+
|
|
52
|
+
### CLI 命令
|
|
53
|
+
|
|
54
|
+
| 命令 | 描述 |
|
|
55
|
+
|---------|-------------|
|
|
56
|
+
| `smart-fork index` | 索引当前会话以供将来搜索 |
|
|
57
|
+
| `smart-fork detect` | 查找相关的历史会话 |
|
|
58
|
+
| `smart-fork detect --all` | 跨所有项目搜索 |
|
|
59
|
+
| `smart-fork list` | 列出所有已索引的会话 |
|
|
60
|
+
| `smart-fork status` | 显示当前状态和建议 |
|
|
61
|
+
| `smart-fork export <id>` | 将会话导出为 JSON |
|
|
30
62
|
|
|
31
|
-
|
|
63
|
+
### Claude Code 集成
|
|
64
|
+
|
|
65
|
+
安装后,Claude Code 中可以使用以下 slash 命令:
|
|
32
66
|
|
|
33
67
|
```
|
|
34
68
|
/index-session - 索引当前会话
|
|
@@ -38,8 +72,248 @@ smart-fork detect --all
|
|
|
38
72
|
/fork-status - 显示状态和建议
|
|
39
73
|
```
|
|
40
74
|
|
|
41
|
-
##
|
|
75
|
+
## ⚙️ 配置
|
|
76
|
+
|
|
77
|
+
创建 `~/.smart-fork/config.json`:
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"embedding": {
|
|
82
|
+
"provider": "local",
|
|
83
|
+
"model": "all-MiniLM-L6-v2",
|
|
84
|
+
"dimension": 384
|
|
85
|
+
},
|
|
86
|
+
"vectorStore": {
|
|
87
|
+
"provider": "local",
|
|
88
|
+
"collectionName": "smart-fork-sessions"
|
|
89
|
+
},
|
|
90
|
+
"storage": {
|
|
91
|
+
"sessionsDir": "~/.smart-fork/sessions",
|
|
92
|
+
"indexPath": "~/.smart-fork/index.json"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 嵌入提供者
|
|
98
|
+
|
|
99
|
+
#### 本地(默认)- 无需 API 密钥
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"embedding": {
|
|
103
|
+
"provider": "local",
|
|
104
|
+
"model": "all-MiniLM-L6-v2"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### OpenAI
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"embedding": {
|
|
113
|
+
"provider": "openai",
|
|
114
|
+
"model": "text-embedding-3-small"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
需要 `OPENAI_API_KEY` 环境变量。
|
|
119
|
+
|
|
120
|
+
#### Ollama
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"embedding": {
|
|
124
|
+
"provider": "ollama",
|
|
125
|
+
"model": "nomic-embed-text"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
需要运行 Ollama 服务器。
|
|
130
|
+
|
|
131
|
+
## 💡 使用示例
|
|
132
|
+
|
|
133
|
+
### 示例 1:使用对话历史索引会话
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# 创建对话历史文件
|
|
137
|
+
cat > conversation.json << 'EOF'
|
|
138
|
+
[
|
|
139
|
+
{
|
|
140
|
+
"id": "turn-1",
|
|
141
|
+
"timestamp": 1709400000000,
|
|
142
|
+
"userMessage": {
|
|
143
|
+
"content": "如何实现用户认证?",
|
|
144
|
+
"metadata": { "files": ["auth.js"] }
|
|
145
|
+
},
|
|
146
|
+
"assistantMessage": {
|
|
147
|
+
"content": "建议使用 JWT + OAuth2。JWT 适合无状态认证,OAuth2 适合第三方登录。",
|
|
148
|
+
"toolCalls": [{"id": "1", "type": "search", "parameters": {"query": "JWT 最佳实践"}}]
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"id": "turn-2",
|
|
153
|
+
"timestamp": 1709400100000,
|
|
154
|
+
"userMessage": {
|
|
155
|
+
"content": "给我代码示例"
|
|
156
|
+
},
|
|
157
|
+
"assistantMessage": {
|
|
158
|
+
"content": "这是一个使用 Node.js 和 jsonwebtoken 的示例...",
|
|
159
|
+
"toolCalls": [
|
|
160
|
+
{"id": "2", "type": "read_file", "parameters": {"path": "examples/auth.js"}},
|
|
161
|
+
{"id": "3", "type": "edit_file", "parameters": {"path": "src/auth.js"}}
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
EOF
|
|
167
|
+
|
|
168
|
+
# 索引会话
|
|
169
|
+
smart-fork index --conversation conversation.json --summary "使用 JWT 的用户认证" --tags "auth,jwt,nodejs"
|
|
170
|
+
|
|
171
|
+
# 输出:
|
|
172
|
+
# ✓ Session indexed successfully!
|
|
173
|
+
# Session ID: 096549e9-13bd-45bd-9f6c-659d55c78b35
|
|
174
|
+
# Conversation turns: 2
|
|
175
|
+
# Total messages: 4
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 示例 2:查找并恢复会话
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# 搜索相关会话
|
|
182
|
+
smart-fork detect --query "认证 JWT 代码示例"
|
|
183
|
+
|
|
184
|
+
# 输出:
|
|
185
|
+
# ✓ Found 1 relevant session(s):
|
|
186
|
+
#
|
|
187
|
+
# 1. my-first-app
|
|
188
|
+
# Path: D:\\claudecode\\MyAICodes\\my-first-app
|
|
189
|
+
# Relevance: 85%
|
|
190
|
+
# Summary: 使用 JWT 的用户认证
|
|
191
|
+
# Last updated: 2026/3/2
|
|
192
|
+
|
|
193
|
+
# 切换到会话
|
|
194
|
+
smart-fork fork-to 096549e9-13bd-45bd-9f6c-659d55c78b35
|
|
195
|
+
|
|
196
|
+
# 输出:
|
|
197
|
+
# 💬 对话历史:
|
|
198
|
+
# ────────────────────────────────────────────────────────────
|
|
199
|
+
# [1] 👤 用户:
|
|
200
|
+
# 如何实现用户认证?
|
|
201
|
+
# 🤖 助手:
|
|
202
|
+
# 建议使用 JWT + OAuth2...
|
|
203
|
+
# 🔧 工具调用:search
|
|
204
|
+
# ────────────────────────────────────────────────────────────
|
|
205
|
+
# [2] 👤 用户:
|
|
206
|
+
# 给我代码示例
|
|
207
|
+
# 🤖 助手:
|
|
208
|
+
# 这是一个 Node.js 示例...
|
|
209
|
+
# 🔧 工具调用:read_file, edit_file
|
|
210
|
+
# ────────────────────────────────────────────────────────────
|
|
211
|
+
# ✨ Total turns: 2
|
|
212
|
+
# 💡 你可以从这里继续对话。
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 示例 3:跨项目搜索
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# 在多个项目中索引会话
|
|
219
|
+
# 项目 A:API 网关
|
|
220
|
+
cd ~/projects/api-gateway
|
|
221
|
+
smart-fork index --summary "实现限流中间件"
|
|
222
|
+
|
|
223
|
+
# 项目 B:前端
|
|
224
|
+
cd ~/projects/frontend
|
|
225
|
+
smart-fork index --summary "设置 React 认证上下文"
|
|
226
|
+
|
|
227
|
+
# 跨所有项目搜索
|
|
228
|
+
cd ~/projects/api-gateway
|
|
229
|
+
smart-fork detect --all --query "认证中间件"
|
|
230
|
+
|
|
231
|
+
# 结果将显示来自两个项目的相关会话!
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### 示例 4:使用 Claude Code Slash 命令
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# 在 Claude Code 中使用 slash 命令:
|
|
238
|
+
|
|
239
|
+
# 索引当前会话
|
|
240
|
+
/index-session 实现用户认证 --tags auth,jwt
|
|
241
|
+
|
|
242
|
+
# 稍后,查找相关会话
|
|
243
|
+
/fork-detect
|
|
244
|
+
|
|
245
|
+
# 切换到指定会话
|
|
246
|
+
/fork-to 096549e9-13bd-45bd-9f6c-659d55c78b35
|
|
247
|
+
|
|
248
|
+
# 列出所有会话
|
|
249
|
+
/list-sessions
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## 📁 数据存储
|
|
253
|
+
|
|
254
|
+
所有数据本地存储在 `~/.smart-fork/`:
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
~/.smart-fork/
|
|
258
|
+
├── sessions/ # 完整会话数据 (JSON)
|
|
259
|
+
├── index.json # 会话索引和嵌入向量
|
|
260
|
+
└── config.json # 用户配置
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## 🔧 开发
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# 克隆仓库
|
|
267
|
+
git clone https://github.com/fjibj/claude-code-smart-fork.git
|
|
268
|
+
cd claude-code-smart-fork
|
|
269
|
+
|
|
270
|
+
# 安装依赖
|
|
271
|
+
npm install
|
|
272
|
+
|
|
273
|
+
# 构建项目
|
|
274
|
+
npm run build
|
|
275
|
+
|
|
276
|
+
# 运行测试
|
|
277
|
+
npm test
|
|
278
|
+
|
|
279
|
+
# 开发模式
|
|
280
|
+
npm run dev
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## 📚 API 使用
|
|
284
|
+
|
|
285
|
+
```typescript
|
|
286
|
+
import { ForkDetector, SessionManager } from 'claude-code-smart-fork';
|
|
287
|
+
|
|
288
|
+
const detector = new ForkDetector();
|
|
289
|
+
await detector.initialize();
|
|
290
|
+
|
|
291
|
+
// 查找相关会话
|
|
292
|
+
const results = await detector.findRelevantSessions({
|
|
293
|
+
text: "如何实现认证?",
|
|
294
|
+
limit: 5
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
// 切换到会话
|
|
298
|
+
const sessionManager = new SessionManager();
|
|
299
|
+
await sessionManager.forkToSession(results[0].session.id);
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## 🤝 贡献
|
|
303
|
+
|
|
304
|
+
欢迎贡献!请参阅 [CONTRIBUTING.md](CONTRIBUTING.md) 获取指南。
|
|
305
|
+
|
|
306
|
+
## 📄 许可证
|
|
307
|
+
|
|
308
|
+
MIT 许可证 - 详见 [LICENSE](LICENSE) 文件。
|
|
309
|
+
|
|
310
|
+
## 🙏 致谢
|
|
311
|
+
|
|
312
|
+
- 灵感来自对更好的 Claude Code 会话管理的需求
|
|
313
|
+
- 感谢开源社区提供的强大工具
|
|
314
|
+
|
|
315
|
+
## 📮 支持
|
|
42
316
|
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
45
|
-
-
|
|
317
|
+
- 🐛 [报告 Bug](https://github.com/fjibj/claude-code-smart-fork/issues)
|
|
318
|
+
- 💡 [请求功能](https://github.com/fjibj/claude-code-smart-fork/issues)
|
|
319
|
+
- 📧 联系:fjibj@users.noreply.github.com
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-smart-fork",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Smart session forking for Claude Code - find and resume relevant historical sessions across projects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
13
|
"dist/**/*",
|
|
14
|
+
"scripts/**/*",
|
|
14
15
|
"LICENSE",
|
|
15
16
|
"README.md",
|
|
17
|
+
"README.zh-CN.md",
|
|
16
18
|
"CHANGELOG.md"
|
|
17
19
|
],
|
|
18
20
|
"scripts": {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-install script
|
|
3
|
+
* Sets up Claude Code integration automatically
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const fs = require('fs');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const os = require('os');
|
|
9
|
+
|
|
10
|
+
function installClaudeHooks() {
|
|
11
|
+
console.log('🔧 Setting up Claude Code Smart Fork integration...\n');
|
|
12
|
+
|
|
13
|
+
// Find Claude Code configuration directory
|
|
14
|
+
const possiblePaths = [
|
|
15
|
+
// Cross-platform: ~/.claude/settings.json (primary location for Claude Code)
|
|
16
|
+
path.join(os.homedir(), '.claude', 'settings.json'),
|
|
17
|
+
// macOS
|
|
18
|
+
path.join(os.homedir(), 'Library', 'Application Support', 'Claude', 'settings.json'),
|
|
19
|
+
// Linux
|
|
20
|
+
path.join(os.homedir(), '.config', 'claude', 'settings.json'),
|
|
21
|
+
// Windows
|
|
22
|
+
path.join(os.homedir(), 'AppData', 'Roaming', 'Claude', 'settings.json'),
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
// Check for CLAUDE_CONFIG environment variable
|
|
26
|
+
if (process.env.CLAUDE_CONFIG) {
|
|
27
|
+
possiblePaths.unshift(path.join(process.env.CLAUDE_CONFIG, 'settings.json'));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let claudeConfigPath = null;
|
|
31
|
+
for (const p of possiblePaths) {
|
|
32
|
+
if (fs.existsSync(p)) {
|
|
33
|
+
claudeConfigPath = p;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!claudeConfigPath) {
|
|
39
|
+
console.log('⚠️ Claude Code configuration not found automatically.');
|
|
40
|
+
console.log('To manually install slash commands, add the following to your Claude Code settings:\n');
|
|
41
|
+
console.log(JSON.stringify({
|
|
42
|
+
slashCommands: [
|
|
43
|
+
{
|
|
44
|
+
name: 'fork-detect',
|
|
45
|
+
description: 'Find relevant historical sessions across all projects',
|
|
46
|
+
entrypoint: 'npx smart-fork detect'
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'fork-to',
|
|
50
|
+
description: 'Switch to a specific historical session',
|
|
51
|
+
entrypoint: 'npx smart-fork fork-to'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'index-session',
|
|
55
|
+
description: 'Index current session for future searching',
|
|
56
|
+
entrypoint: 'npx smart-fork index'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'list-sessions',
|
|
60
|
+
description: 'List all indexed sessions',
|
|
61
|
+
entrypoint: 'npx smart-fork list'
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}, null, 2));
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Read existing config
|
|
69
|
+
let config = {};
|
|
70
|
+
try {
|
|
71
|
+
config = JSON.parse(fs.readFileSync(claudeConfigPath, 'utf-8'));
|
|
72
|
+
} catch {
|
|
73
|
+
// File doesn't exist or is invalid, start fresh
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Add our slash commands
|
|
77
|
+
config.slashCommands = config.slashCommands || [];
|
|
78
|
+
|
|
79
|
+
const ourCommands = [
|
|
80
|
+
{
|
|
81
|
+
name: 'fork-detect',
|
|
82
|
+
description: 'Find relevant historical sessions across all projects',
|
|
83
|
+
entrypoint: 'npx smart-fork detect'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'fork-to',
|
|
87
|
+
description: 'Switch to a specific historical session (usage: /fork-to <session-id>)',
|
|
88
|
+
entrypoint: 'npx smart-fork fork-to'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'index-session',
|
|
92
|
+
description: 'Index current session for future searching',
|
|
93
|
+
entrypoint: 'npx smart-fork index'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'list-sessions',
|
|
97
|
+
description: 'List all indexed sessions',
|
|
98
|
+
entrypoint: 'npx smart-fork list'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'fork-status',
|
|
102
|
+
description: 'Show current fork status and suggestions',
|
|
103
|
+
entrypoint: 'npx smart-fork status'
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
// Remove existing commands with same names
|
|
108
|
+
config.slashCommands = config.slashCommands.filter(
|
|
109
|
+
cmd => !ourCommands.some(our => our.name === cmd.name)
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
// Add our commands
|
|
113
|
+
config.slashCommands.push(...ourCommands);
|
|
114
|
+
|
|
115
|
+
// Save config
|
|
116
|
+
fs.mkdirSync(path.dirname(claudeConfigPath), { recursive: true });
|
|
117
|
+
fs.writeFileSync(claudeConfigPath, JSON.stringify(config, null, 2));
|
|
118
|
+
|
|
119
|
+
console.log('✅ Claude Code integration installed successfully!\n');
|
|
120
|
+
console.log('Available slash commands:');
|
|
121
|
+
ourCommands.forEach(cmd => {
|
|
122
|
+
console.log(` /${cmd.name} - ${cmd.description}`);
|
|
123
|
+
});
|
|
124
|
+
console.log('\nUsage:');
|
|
125
|
+
console.log(' 1. Index your current session: /index-session');
|
|
126
|
+
console.log(' 2. Later, find relevant sessions: /fork-detect');
|
|
127
|
+
console.log(' 3. Switch to a session: /fork-to <session-id>');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Run installation
|
|
131
|
+
installClaudeHooks();
|