claude-code-smart-fork 1.0.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/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +317 -0
- package/README.zh-CN.md +45 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +351 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/__tests__/embedding.test.d.ts +2 -0
- package/dist/core/__tests__/embedding.test.d.ts.map +1 -0
- package/dist/core/__tests__/embedding.test.js +90 -0
- package/dist/core/__tests__/embedding.test.js.map +1 -0
- package/dist/core/config.d.ts +19 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +105 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/embedding.d.ts +28 -0
- package/dist/core/embedding.d.ts.map +1 -0
- package/dist/core/embedding.js +137 -0
- package/dist/core/embedding.js.map +1 -0
- package/dist/core/fork-detector.d.ts +38 -0
- package/dist/core/fork-detector.d.ts.map +1 -0
- package/dist/core/fork-detector.js +234 -0
- package/dist/core/fork-detector.js.map +1 -0
- package/dist/core/session-manager.d.ts +77 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +525 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/vector-store.d.ts +47 -0
- package/dist/core/vector-store.d.ts.map +1 -0
- package/dist/core/vector-store.js +204 -0
- package/dist/core/vector-store.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/claude-code.d.ts +53 -0
- package/dist/integrations/claude-code.d.ts.map +1 -0
- package/dist/integrations/claude-code.js +277 -0
- package/dist/integrations/claude-code.js.map +1 -0
- package/dist/types/index.d.ts +106 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vector Store - Handles storage and retrieval of session embeddings
|
|
4
|
+
* Supports multiple backends: local JSON, Chroma, Pinecone
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.VectorStore = void 0;
|
|
41
|
+
const fs = __importStar(require("fs/promises"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const config_1 = require("./config");
|
|
44
|
+
class VectorStore {
|
|
45
|
+
config;
|
|
46
|
+
localData = new Map();
|
|
47
|
+
initialized = false;
|
|
48
|
+
async initialize(config) {
|
|
49
|
+
this.config = config;
|
|
50
|
+
if (config.provider === 'local') {
|
|
51
|
+
await this.loadLocalData();
|
|
52
|
+
}
|
|
53
|
+
this.initialized = true;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Add or update a session in the vector store
|
|
57
|
+
*/
|
|
58
|
+
async upsert(session) {
|
|
59
|
+
if (!this.initialized)
|
|
60
|
+
await this.initialize(this.config);
|
|
61
|
+
switch (this.config.provider) {
|
|
62
|
+
case 'local':
|
|
63
|
+
await this.upsertLocal(session);
|
|
64
|
+
break;
|
|
65
|
+
case 'chroma':
|
|
66
|
+
await this.upsertChroma(session);
|
|
67
|
+
break;
|
|
68
|
+
case 'pinecone':
|
|
69
|
+
await this.upsertPinecone(session);
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Search for similar sessions
|
|
75
|
+
*/
|
|
76
|
+
async search(params) {
|
|
77
|
+
if (!this.initialized)
|
|
78
|
+
await this.initialize(this.config);
|
|
79
|
+
switch (this.config.provider) {
|
|
80
|
+
case 'local':
|
|
81
|
+
return this.searchLocal(params);
|
|
82
|
+
case 'chroma':
|
|
83
|
+
return this.searchChroma(params);
|
|
84
|
+
case 'pinecone':
|
|
85
|
+
return this.searchPinecone(params);
|
|
86
|
+
default:
|
|
87
|
+
return this.searchLocal(params);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Delete a session from the store
|
|
92
|
+
*/
|
|
93
|
+
async delete(sessionId) {
|
|
94
|
+
if (!this.initialized)
|
|
95
|
+
await this.initialize(this.config);
|
|
96
|
+
switch (this.config.provider) {
|
|
97
|
+
case 'local':
|
|
98
|
+
this.localData.delete(sessionId);
|
|
99
|
+
await this.saveLocalData();
|
|
100
|
+
break;
|
|
101
|
+
case 'chroma':
|
|
102
|
+
// TODO: Implement Chroma delete
|
|
103
|
+
break;
|
|
104
|
+
case 'pinecone':
|
|
105
|
+
// TODO: Implement Pinecone delete
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get all sessions
|
|
111
|
+
*/
|
|
112
|
+
async getAll() {
|
|
113
|
+
if (!this.initialized)
|
|
114
|
+
await this.initialize(this.config);
|
|
115
|
+
switch (this.config.provider) {
|
|
116
|
+
case 'local':
|
|
117
|
+
return Array.from(this.localData.values());
|
|
118
|
+
default:
|
|
119
|
+
return [];
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// Local JSON implementation
|
|
123
|
+
async loadLocalData() {
|
|
124
|
+
try {
|
|
125
|
+
const indexPath = config_1.configManager.getIndexPath();
|
|
126
|
+
const content = await fs.readFile(indexPath, 'utf-8');
|
|
127
|
+
const data = JSON.parse(content);
|
|
128
|
+
this.localData = new Map(Object.entries(data.sessions || {}).map(([id, session]) => [
|
|
129
|
+
id,
|
|
130
|
+
session
|
|
131
|
+
]));
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
// Index doesn't exist yet, start fresh
|
|
135
|
+
this.localData = new Map();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async saveLocalData() {
|
|
139
|
+
const indexPath = config_1.configManager.getIndexPath();
|
|
140
|
+
await fs.mkdir(path.dirname(indexPath), { recursive: true });
|
|
141
|
+
const data = {
|
|
142
|
+
version: '1.0.0',
|
|
143
|
+
updatedAt: Date.now(),
|
|
144
|
+
sessions: Object.fromEntries(this.localData)
|
|
145
|
+
};
|
|
146
|
+
await fs.writeFile(indexPath, JSON.stringify(data, null, 2));
|
|
147
|
+
}
|
|
148
|
+
async upsertLocal(session) {
|
|
149
|
+
this.localData.set(session.id, session);
|
|
150
|
+
await this.saveLocalData();
|
|
151
|
+
}
|
|
152
|
+
searchLocal(params) {
|
|
153
|
+
const results = [];
|
|
154
|
+
for (const session of this.localData.values()) {
|
|
155
|
+
// Apply filter if specified
|
|
156
|
+
if (params.filter) {
|
|
157
|
+
const matches = Object.entries(params.filter).every(([key, value]) => session[key] === value);
|
|
158
|
+
if (!matches)
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
// Calculate cosine similarity
|
|
162
|
+
if (session.embedding) {
|
|
163
|
+
const score = this.cosineSimilarity(params.vector, session.embedding);
|
|
164
|
+
results.push({ session, score });
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// Sort by score descending and limit results
|
|
168
|
+
return results
|
|
169
|
+
.sort((a, b) => b.score - a.score)
|
|
170
|
+
.slice(0, params.limit);
|
|
171
|
+
}
|
|
172
|
+
// Chroma implementation (placeholder)
|
|
173
|
+
async upsertChroma(session) {
|
|
174
|
+
// TODO: Implement ChromaDB integration
|
|
175
|
+
// Requires: npm install chromadb
|
|
176
|
+
throw new Error('Chroma provider not yet implemented');
|
|
177
|
+
}
|
|
178
|
+
async searchChroma(params) {
|
|
179
|
+
throw new Error('Chroma provider not yet implemented');
|
|
180
|
+
}
|
|
181
|
+
// Pinecone implementation (placeholder)
|
|
182
|
+
async upsertPinecone(session) {
|
|
183
|
+
// TODO: Implement Pinecone integration
|
|
184
|
+
// Requires: npm install @pinecone-database/pinecone
|
|
185
|
+
throw new Error('Pinecone provider not yet implemented');
|
|
186
|
+
}
|
|
187
|
+
async searchPinecone(params) {
|
|
188
|
+
throw new Error('Pinecone provider not yet implemented');
|
|
189
|
+
}
|
|
190
|
+
// Utility: Cosine similarity
|
|
191
|
+
cosineSimilarity(a, b) {
|
|
192
|
+
let dotProduct = 0;
|
|
193
|
+
let normA = 0;
|
|
194
|
+
let normB = 0;
|
|
195
|
+
for (let i = 0; i < a.length; i++) {
|
|
196
|
+
dotProduct += a[i] * b[i];
|
|
197
|
+
normA += a[i] * a[i];
|
|
198
|
+
normB += b[i] * b[i];
|
|
199
|
+
}
|
|
200
|
+
return dotProduct / (Math.sqrt(normA) * Math.sqrt(normB));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.VectorStore = VectorStore;
|
|
204
|
+
//# sourceMappingURL=vector-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vector-store.js","sourceRoot":"","sources":["../../src/core/vector-store.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAAkC;AAClC,2CAA6B;AAE7B,qCAAyC;AAazC,MAAa,WAAW;IACd,MAAM,CAAyB;IAC/B,SAAS,GAA8B,IAAI,GAAG,EAAE,CAAC;IACjD,WAAW,GAAG,KAAK,CAAC;IAE5B,KAAK,CAAC,UAAU,CAAC,MAA6B;QAC5C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,IAAI,MAAM,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YAChC,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,OAAqB;QAChC,IAAI,CAAC,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE1D,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC7B,KAAK,OAAO;gBACV,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;gBAChC,MAAM;YACR,KAAK,QAAQ;gBACX,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;gBACjC,M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EG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;AAEA;;GAEG;;AAEH,+BAAgC;AAEhC,cAAc;AACd,aAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code Integration
|
|
3
|
+
* Provides /fork-detect as a slash command within Claude Code
|
|
4
|
+
*/
|
|
5
|
+
interface SlashCommandContext {
|
|
6
|
+
query?: string;
|
|
7
|
+
project?: string;
|
|
8
|
+
all?: boolean;
|
|
9
|
+
limit?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class ClaudeCodeIntegration {
|
|
12
|
+
private detector;
|
|
13
|
+
private sessionManager;
|
|
14
|
+
private initialized;
|
|
15
|
+
constructor();
|
|
16
|
+
initialize(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Handle /fork-detect slash command
|
|
19
|
+
* This is the main entry point for Claude Code integration
|
|
20
|
+
*/
|
|
21
|
+
handleForkDetect(args: string, context?: SlashCommandContext): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Handle /fork-to slash command
|
|
24
|
+
* Switches to a specific historical session with full conversation context
|
|
25
|
+
*/
|
|
26
|
+
handleForkTo(sessionId: string): Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Handle /index-session slash command
|
|
29
|
+
* Indexes the current session with full conversation history for future searching
|
|
30
|
+
*/
|
|
31
|
+
handleIndexSession(summary?: string, tags?: string[], conversationHistory?: any[]): Promise<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Extract current conversation from Claude Code context
|
|
34
|
+
* This would be called by Claude Code with the actual conversation data
|
|
35
|
+
*/
|
|
36
|
+
private extractCurrentConversation;
|
|
37
|
+
/**
|
|
38
|
+
* Handle /list-sessions slash command
|
|
39
|
+
*/
|
|
40
|
+
handleListSessions(projectPath?: string): Promise<string>;
|
|
41
|
+
/**
|
|
42
|
+
* Handle /fork-status slash command
|
|
43
|
+
* Shows current fork status and recent sessions
|
|
44
|
+
*/
|
|
45
|
+
handleForkStatus(): Promise<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Parse command arguments
|
|
48
|
+
*/
|
|
49
|
+
private parseArgs;
|
|
50
|
+
}
|
|
51
|
+
export declare const claudeCodeIntegration: ClaudeCodeIntegration;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/integrations/claude-code.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,UAAU,mBAAmB;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,WAAW,CAAS;;IAOtB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAUjC;;;OAGG;IACG,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;IAkExF;;;OAGG;IACG,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAsDtD;;;OAGG;IACG,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,mBAAmB,CAAC,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAkCzG;;;OAGG;YACW,0BAA0B;IAMxC;;OAEG;IACG,kBAAkB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmC/D;;;OAGG;IACG,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IA2CzC;;OAEG;IACH,OAAO,CAAC,SAAS;CA6BlB;AAGD,eAAO,MAAM,qBAAqB,uBAA8B,CAAC"}
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Claude Code Integration
|
|
4
|
+
* Provides /fork-detect as a slash command within Claude Code
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.claudeCodeIntegration = exports.ClaudeCodeIntegration = void 0;
|
|
8
|
+
const fork_detector_1 = require("../core/fork-detector");
|
|
9
|
+
const session_manager_1 = require("../core/session-manager");
|
|
10
|
+
const config_1 = require("../core/config");
|
|
11
|
+
class ClaudeCodeIntegration {
|
|
12
|
+
detector;
|
|
13
|
+
sessionManager;
|
|
14
|
+
initialized = false;
|
|
15
|
+
constructor() {
|
|
16
|
+
this.detector = new fork_detector_1.ForkDetector();
|
|
17
|
+
this.sessionManager = new session_manager_1.SessionManager();
|
|
18
|
+
}
|
|
19
|
+
async initialize() {
|
|
20
|
+
if (this.initialized)
|
|
21
|
+
return;
|
|
22
|
+
await config_1.configManager.load();
|
|
23
|
+
await this.detector.initialize();
|
|
24
|
+
await this.sessionManager.initialize();
|
|
25
|
+
this.initialized = true;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Handle /fork-detect slash command
|
|
29
|
+
* This is the main entry point for Claude Code integration
|
|
30
|
+
*/
|
|
31
|
+
async handleForkDetect(args, context = {}) {
|
|
32
|
+
await this.initialize();
|
|
33
|
+
// Parse arguments
|
|
34
|
+
const parsed = this.parseArgs(args);
|
|
35
|
+
// Extract current context from the conversation
|
|
36
|
+
const query = context.query ||
|
|
37
|
+
parsed.query ||
|
|
38
|
+
await this.detector.extractCurrentContext();
|
|
39
|
+
console.log('🔍 Searching for relevant sessions...\n');
|
|
40
|
+
// Search for relevant sessions
|
|
41
|
+
const results = await this.detector.findRelevantSessions({
|
|
42
|
+
text: query,
|
|
43
|
+
projectPath: parsed.all ? undefined : (context.project || parsed.project),
|
|
44
|
+
limit: parsed.limit || 5,
|
|
45
|
+
threshold: 0.6
|
|
46
|
+
});
|
|
47
|
+
if (results.length === 0) {
|
|
48
|
+
return `## No Relevant Sessions Found
|
|
49
|
+
|
|
50
|
+
I couldn't find any historical sessions that match your current context.
|
|
51
|
+
|
|
52
|
+
**Suggestions:**
|
|
53
|
+
- Try running with \`--all\` to search across all projects
|
|
54
|
+
- Lower the similarity threshold
|
|
55
|
+
- Start a new session and index it with \`/index-session\`
|
|
56
|
+
|
|
57
|
+
**Current context:**
|
|
58
|
+
\`\`\`
|
|
59
|
+
${query.substring(0, 200)}...
|
|
60
|
+
\`\`\``;
|
|
61
|
+
}
|
|
62
|
+
// Format results for Claude Code display
|
|
63
|
+
let output = `## 🔀 Found ${results.length} Relevant Session(s)\n\n`;
|
|
64
|
+
results.forEach((result, index) => {
|
|
65
|
+
const session = result.session;
|
|
66
|
+
const score = Math.round(result.score * 100);
|
|
67
|
+
output += `### ${index + 1}. ${session.projectName} (${score}% match)\n\n`;
|
|
68
|
+
output += `- **Project:** \`${session.projectPath}\`\n`;
|
|
69
|
+
output += `- **Last Active:** ${new Date(session.updatedAt).toLocaleString()}\n`;
|
|
70
|
+
output += `- **Messages:** ${session.messageCount}\n`;
|
|
71
|
+
output += `- **Summary:** ${session.summary}\n`;
|
|
72
|
+
if (session.tags.length > 0) {
|
|
73
|
+
output += `- **Tags:** ${session.tags.map(t => `\`${t}\``).join(', ')}\n`;
|
|
74
|
+
}
|
|
75
|
+
output += `\n**Action:** Use \`/fork-to ${session.id}\` to switch to this session\n\n`;
|
|
76
|
+
output += `---\n\n`;
|
|
77
|
+
});
|
|
78
|
+
output += `## Next Steps\n\n`;
|
|
79
|
+
output += `1. Choose a session from above\n`;
|
|
80
|
+
output += `2. Run \`/fork-to <session-id>\` to switch\n`;
|
|
81
|
+
output += `3. Or run \`/fork-detect --all\` to search across all projects\n`;
|
|
82
|
+
return output;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Handle /fork-to slash command
|
|
86
|
+
* Switches to a specific historical session with full conversation context
|
|
87
|
+
*/
|
|
88
|
+
async handleForkTo(sessionId) {
|
|
89
|
+
await this.initialize();
|
|
90
|
+
try {
|
|
91
|
+
// Load session to show preview before forking
|
|
92
|
+
const session = await this.sessionManager['loadSession'](sessionId);
|
|
93
|
+
if (!session) {
|
|
94
|
+
return `## ❌ Session Not Found
|
|
95
|
+
|
|
96
|
+
Session \`${sessionId}\` not found.
|
|
97
|
+
|
|
98
|
+
Use \`/list-sessions\` to see available sessions.`;
|
|
99
|
+
}
|
|
100
|
+
// Show session preview
|
|
101
|
+
let preview = `## 🔀 Forking to Session
|
|
102
|
+
|
|
103
|
+
**Session ID:** \`${sessionId}\`
|
|
104
|
+
**Project:** ${session.projectName}
|
|
105
|
+
**Summary:** ${session.summary}
|
|
106
|
+
|
|
107
|
+
`;
|
|
108
|
+
// Show conversation preview (last 3 turns)
|
|
109
|
+
const history = session.conversationHistory || [];
|
|
110
|
+
if (history.length > 0) {
|
|
111
|
+
preview += `### 💬 Conversation Preview (last ${Math.min(3, history.length)} of ${history.length} turns):\n\n`;
|
|
112
|
+
const previewTurns = history.slice(-3);
|
|
113
|
+
previewTurns.forEach((turn, idx) => {
|
|
114
|
+
const turnNum = history.length - 3 + idx + 1;
|
|
115
|
+
preview += `**Turn ${turnNum}:**\n`;
|
|
116
|
+
preview += `- 👤 **You:** ${turn.userMessage.content.substring(0, 100)}${turn.userMessage.content.length > 100 ? '...' : ''}\n`;
|
|
117
|
+
if (turn.assistantMessage) {
|
|
118
|
+
preview += `- 🤖 **Claude:** ${turn.assistantMessage.content.substring(0, 100)}${turn.assistantMessage.content.length > 100 ? '...' : ''}\n`;
|
|
119
|
+
}
|
|
120
|
+
preview += '\n';
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
preview += `Click below to complete the fork and continue the conversation:\n`;
|
|
124
|
+
preview += `[✅ Complete Fork](/fork-to-confirm ${sessionId})\n\n`;
|
|
125
|
+
preview += `Or run \`/fork-to ${sessionId}\` to switch directly.`;
|
|
126
|
+
return preview;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
return `## ❌ Fork Failed
|
|
130
|
+
|
|
131
|
+
Error: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
132
|
+
|
|
133
|
+
Use \`/list-sessions\` to see available sessions.`;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Handle /index-session slash command
|
|
138
|
+
* Indexes the current session with full conversation history for future searching
|
|
139
|
+
*/
|
|
140
|
+
async handleIndexSession(summary, tags, conversationHistory) {
|
|
141
|
+
await this.initialize();
|
|
142
|
+
try {
|
|
143
|
+
// If no conversation history provided, try to extract from current Claude Code context
|
|
144
|
+
if (!conversationHistory) {
|
|
145
|
+
conversationHistory = await this.extractCurrentConversation();
|
|
146
|
+
}
|
|
147
|
+
const session = await this.sessionManager.indexCurrentSession({
|
|
148
|
+
summary,
|
|
149
|
+
tags,
|
|
150
|
+
conversationHistory
|
|
151
|
+
});
|
|
152
|
+
const turns = session.conversationHistory?.length || 0;
|
|
153
|
+
return `## ✅ Session Indexed Successfully
|
|
154
|
+
|
|
155
|
+
**Session ID:** \`${session.id}\`
|
|
156
|
+
**Project:** ${session.projectName}
|
|
157
|
+
**Conversation Turns:** ${turns}
|
|
158
|
+
**Summary:** ${session.summary}
|
|
159
|
+
|
|
160
|
+
This session is now searchable with full conversation history. When you have a similar task in the future, use \`/fork-detect\` to find and resume this session.
|
|
161
|
+
|
|
162
|
+
The forked session will include both your questions and Claude's responses.`;
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return `## ❌ Indexing Failed
|
|
166
|
+
|
|
167
|
+
Error: ${error instanceof Error ? error.message : 'Unknown error'}`;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Extract current conversation from Claude Code context
|
|
172
|
+
* This would be called by Claude Code with the actual conversation data
|
|
173
|
+
*/
|
|
174
|
+
async extractCurrentConversation() {
|
|
175
|
+
// In a real implementation, this would receive data from Claude Code
|
|
176
|
+
// For now, return empty array and let session-manager use fallback
|
|
177
|
+
return [];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Handle /list-sessions slash command
|
|
181
|
+
*/
|
|
182
|
+
async handleListSessions(projectPath) {
|
|
183
|
+
await this.initialize();
|
|
184
|
+
const sessions = await this.sessionManager.listSessions(projectPath);
|
|
185
|
+
if (sessions.length === 0) {
|
|
186
|
+
return `## No Indexed Sessions
|
|
187
|
+
|
|
188
|
+
No sessions have been indexed yet.
|
|
189
|
+
|
|
190
|
+
Use \`/index-session\` to index the current session.`;
|
|
191
|
+
}
|
|
192
|
+
// Group by project
|
|
193
|
+
const byProject = sessions.reduce((acc, s) => {
|
|
194
|
+
acc[s.projectPath] = acc[s.projectPath] || [];
|
|
195
|
+
acc[s.projectPath].push(s);
|
|
196
|
+
return acc;
|
|
197
|
+
}, {});
|
|
198
|
+
let output = `## 📋 Indexed Sessions (${sessions.length} total)\n\n`;
|
|
199
|
+
Object.entries(byProject).forEach(([projectPath, projectSessions]) => {
|
|
200
|
+
output += `### ${projectPath}\n\n`;
|
|
201
|
+
projectSessions.forEach(session => {
|
|
202
|
+
output += `- **${session.summary.substring(0, 60)}**...\n`;
|
|
203
|
+
output += ` ID: \`${session.id}\` | ${new Date(session.updatedAt).toLocaleDateString()} | ${session.messageCount} messages\n`;
|
|
204
|
+
output += ` [Fork](/fork-to ${session.id})\n\n`;
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
return output;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Handle /fork-status slash command
|
|
211
|
+
* Shows current fork status and recent sessions
|
|
212
|
+
*/
|
|
213
|
+
async handleForkStatus() {
|
|
214
|
+
await this.initialize();
|
|
215
|
+
const currentSessionId = process.env.SMART_FORK_SESSION_ID;
|
|
216
|
+
const sessions = await this.sessionManager.listSessions(process.cwd());
|
|
217
|
+
let output = `## 🔀 Fork Status\n\n`;
|
|
218
|
+
if (currentSessionId) {
|
|
219
|
+
output += `**Current Session:** \`${currentSessionId}\`\n`;
|
|
220
|
+
output += `**Forked From:** ${process.env.SMART_FORK_ORIGINAL_CWD || 'Unknown'}\n\n`;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
output += `**Current Session:** New session (not forked)\n\n`;
|
|
224
|
+
}
|
|
225
|
+
// Show suggestions
|
|
226
|
+
const suggestions = await this.detector.suggestRelevantSessions();
|
|
227
|
+
if (suggestions.length > 0) {
|
|
228
|
+
output += `### 💡 Suggested Sessions\n\n`;
|
|
229
|
+
suggestions.slice(0, 3).forEach((s, i) => {
|
|
230
|
+
output += `${i + 1}. **${s.session.projectName}** (${Math.round(s.score * 100)}% relevant)\n`;
|
|
231
|
+
output += ` ${s.session.summary.substring(0, 80)}...\n`;
|
|
232
|
+
output += ` [Fork Now](/fork-to ${s.session.id})\n\n`;
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
// Show recent sessions from current project
|
|
236
|
+
const recentSessions = sessions
|
|
237
|
+
.sort((a, b) => b.updatedAt - a.updatedAt)
|
|
238
|
+
.slice(0, 5);
|
|
239
|
+
if (recentSessions.length > 0) {
|
|
240
|
+
output += `### 📁 Recent Sessions in This Project\n\n`;
|
|
241
|
+
recentSessions.forEach(session => {
|
|
242
|
+
output += `- ${session.summary.substring(0, 60)}...\n`;
|
|
243
|
+
output += ` ${new Date(session.updatedAt).toLocaleDateString()} | [Fork](/fork-to ${session.id})\n\n`;
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return output;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Parse command arguments
|
|
250
|
+
*/
|
|
251
|
+
parseArgs(args) {
|
|
252
|
+
const result = {};
|
|
253
|
+
// Parse --flags
|
|
254
|
+
const allMatch = args.match(/--all/);
|
|
255
|
+
if (allMatch)
|
|
256
|
+
result.all = true;
|
|
257
|
+
const projectMatch = args.match(/--project\s+(\S+)/);
|
|
258
|
+
if (projectMatch)
|
|
259
|
+
result.project = projectMatch[1];
|
|
260
|
+
const limitMatch = args.match(/--limit\s+(\d+)/);
|
|
261
|
+
if (limitMatch)
|
|
262
|
+
result.limit = parseInt(limitMatch[1]);
|
|
263
|
+
// Everything else is the query
|
|
264
|
+
const query = args
|
|
265
|
+
.replace(/--all/g, '')
|
|
266
|
+
.replace(/--project\s+\S+/g, '')
|
|
267
|
+
.replace(/--limit\s+\d+/g, '')
|
|
268
|
+
.trim();
|
|
269
|
+
if (query)
|
|
270
|
+
result.query = query;
|
|
271
|
+
return result;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
exports.ClaudeCodeIntegration = ClaudeCodeIntegration;
|
|
275
|
+
// Export singleton instance
|
|
276
|
+
exports.claudeCodeIntegration = new ClaudeCodeIntegration();
|
|
277
|
+
//# sourceMappingURL=claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/integrations/claude-code.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,yDAAqD;AACrD,6DAAyD;AACzD,2CAA+C;AAS/C,MAAa,qBAAqB;IACxB,QAAQ,CAAe;IACvB,cAAc,CAAiB;IAC/B,WAAW,GAAG,KAAK,CAAC;IAE5B;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,4BAAY,EAAE,CAAC;QACnC,IAAI,CAAC,cAAc,GAAG,IAAI,gCAAc,EAAE,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO;QAE7B,MAAM,sBAAa,CAAC,IAAI,EAAE,CAAC;QAC3B,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU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